/**
 * Medicalnnabis Créditos - Frontend CSS
 * Mi Cuenta + Product display
 * Integrado al theme oscuro/neón de Medicalnnabis.
 */

/* ── Dashboard container ──────────────────────────────── */
.mc-wallet-dashboard { max-width: 900px; }

/* ── Status messages ──────────────────────────────────── */
.mc-wallet-message {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}
.mc-wallet-message-warning {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.4);
    color: #ffa500;
}
.mc-wallet-message-error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.4);
    color: #ff6b6b;
}
.mc-wallet-message-info {
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.25);
    color: rgba(255, 255, 255, 0.8);
}

/* ── Grid layout ──────────────────────────────────────── */
.mc-wallet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 600px) {
    .mc-wallet-grid { grid-template-columns: 1fr; }
}

/* ── Cards ────────────────────────────────────────────── */
.mc-wallet-card {
    background: linear-gradient(135deg, rgba(26, 0, 51, 0.6) 0%, rgba(0, 255, 136, 0.03) 100%);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 10px;
    padding: 20px;
}
.mc-wallet-card h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #00ff88;
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
    padding-bottom: 8px;
}

/* ── Balance display ──────────────────────────────────── */
.mc-wallet-balance-value {
    font-size: 36px;
    font-weight: 700;
    color: #00ff88;
    margin: 8px 0;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}
.mc-wallet-balance-value.mc-negative {
    color: #ff6b6b;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
}
.mc-wallet-balance-label {
    font-size: 13px;
    color: #b0b0b0;
}
.mc-wallet-status {
    margin-top: 10px;
    font-size: 14px;
    color: #b0b0b0;
}
.mc-wallet-status-active {
    color: #00ff88;
    font-weight: 600;
}
.mc-wallet-status-blocked {
    color: #ff6b6b;
    font-weight: 600;
}

/* ── Medical info ─────────────────────────────────────── */
.mc-wallet-medical-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 255, 136, 0.08);
    font-size: 14px;
}
.mc-wallet-medical-row:last-child { border-bottom: none; }
.mc-wallet-medical-label { color: #b0b0b0; }
.mc-wallet-medical-value { font-weight: 600; color: #ffffff; }

/* ── History section ──────────────────────────────────── */
.mc-wallet-history { margin-top: 24px; }
.mc-wallet-history h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #00ff88;
}
.mc-wallet-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: rgba(0, 255, 136, 0.02);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 6px;
    overflow: hidden;
}
.mc-wallet-history-table th {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    font-weight: 600;
    color: #00ff88;
    font-size: 12px;
    background: rgba(0, 255, 136, 0.06);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.mc-wallet-history-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #ffffff;
}
.mc-wallet-history-table tr:last-child td { border-bottom: none; }
.mc-wallet-history-table .mc-amount-positive { color: #00ff88; font-weight: 600; }
.mc-wallet-history-table .mc-amount-negative { color: #ff6b6b; font-weight: 600; }
.mc-wallet-history-table a { color: #00ffff; text-decoration: none; }
.mc-wallet-history-table a:hover { text-decoration: underline; }
@media (max-width: 600px) {
    .mc-wallet-history-table { font-size: 12px; }
    .mc-wallet-history-table th,
    .mc-wallet-history-table td { padding: 6px 4px; }
}

/* ── Empty state ──────────────────────────────────────── */
.mc-wallet-empty {
    color: #b0b0b0;
    font-size: 14px;
    padding: 16px 0;
}

/* ── Type labels ──────────────────────────────────────── */
.mc-type-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.mc-type-label-credit_purchase {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}
.mc-type-label-debit_redemption {
    background: rgba(255, 68, 68, 0.12);
    color: #ff8888;
    border: 1px solid rgba(255, 68, 68, 0.3);
}
.mc-type-label-refund_redemption {
    background: rgba(0, 255, 255, 0.1);
    color: #00ffff;
    border: 1px solid rgba(0, 255, 255, 0.3);
}
.mc-type-label-reverse_purchase {
    background: rgba(255, 165, 0, 0.12);
    color: #ffa500;
    border: 1px solid rgba(255, 165, 0, 0.3);
}
.mc-type-label-admin_adjustment {
    background: rgba(176, 176, 176, 0.1);
    color: #b0b0b0;
    border: 1px solid rgba(176, 176, 176, 0.3);
}
.mc-type-label-system_correction {
    background: rgba(176, 176, 176, 0.1);
    color: #b0b0b0;
    border: 1px solid rgba(176, 176, 176, 0.3);
}

/* ── Pagination ───────────────────────────────────────── */
.mc-wallet-pagination {
    margin-top: 16px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.mc-wallet-pagination a,
.mc-wallet-pagination span {
    padding: 4px 10px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    color: #b0b0b0;
    background: transparent;
}
.mc-wallet-pagination a:hover {
    border-color: #00ff88;
    color: #00ff88;
}
.mc-wallet-pagination .mc-current {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border-color: #00ff88;
}

/* ── Actions ──────────────────────────────────────────── */
.mc-wallet-actions {
    margin-top: 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.mc-wallet-actions a {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.mc-wallet-action-primary {
    background: linear-gradient(135deg, #00ff88 0%, #39ff14 100%);
    color: #000 !important;
    border: none;
}
.mc-wallet-action-primary:hover {
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
    color: #000 !important;
}
.mc-wallet-action-secondary {
    background: transparent;
    color: #00ff88 !important;
    border: 1px solid rgba(0, 255, 136, 0.3);
}
.mc-wallet-action-secondary:hover {
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    color: #00ff88 !important;
}

/* ── History full page ────────────────────────────────── */
.mc-wallet-history-full { max-width: 900px; }
.mc-wallet-history-full .mc-wallet-back {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 14px;
    text-decoration: none;
    color: #00ffff;
}
.mc-wallet-history-full .mc-wallet-back:hover {
    color: #00ff88;
}

/* ── Product token cost badge ─────────────────────────── */
.mc-token-cost-badge {
    display: inline-block;
    margin-top: 8px;
    margin-bottom: 4px;
    padding: 5px 12px;
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}
.mc-token-cost-badge .mc-token-icon {
    margin-right: 4px;
    color: #39ff14;
}

/* ── Fase 6.5: Token-only storefront ─────────────────── */

/* Precio en tokens (reemplaza CLP) */
.mc-price-tokens {
    color: #00ff88;
    font-weight: 700;
    font-size: 1.1em;
}
.mc-price-tokens .mc-token-icon {
    margin-right: 3px;
    color: #39ff14;
}

/* Precio pendiente (sin token_cost) */
.mc-price-pending {
    color: #ffa500;
    font-style: italic;
    font-size: 0.9em;
}

/* Mensaje en producto sin token_cost */
.mc-product-pending-notice {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 10px 0;
}
.mc-product-pending-notice p {
    color: #ffa500;
    margin: 0;
    font-size: 14px;
}

/* Boton deshabilitado en grilla */
.mc-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #888 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* ── Header wallet ───────────────────────────────────── */
.mc-header-wallet {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 12px;
}
.mc-header-balance {
    color: #00ff88;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.mc-header-balance.mc-header-blocked {
    color: #ff6b6b;
}
.mc-header-wallet-icon {
    color: #39ff14;
    margin-right: 2px;
}
.mc-header-buy-credits {
    background: linear-gradient(135deg, #00ff88 0%, #39ff14 100%);
    color: #000 !important;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
}
.mc-header-buy-credits:hover {
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
    transform: translateY(-1px);
}

/* ── Cart token summary (div, antes del <table>) ────── */
.mc-token-cart-summary {
    background: rgba(26, 0, 51, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.mc-token-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 255, 136, 0.1);
}
.mc-token-summary-row:last-child {
    border-bottom: none;
}
.mc-token-summary-row .mc-label {
    color: #b0b0b0;
    font-size: 14px;
}
.mc-token-summary-row .mc-value {
    text-align: right;
}
.mc-token-summary-row .mc-value .mc-price-tokens {
    color: #00ff88;
}
.mc-token-summary-row .mc-value strong {
    font-size: 16px;
}
.mc-token-summary-insufficient .mc-label {
    color: #ff6b6b;
}

/* ── Checkout token summary (tr/td, dentro de <table>) ── */
.mc-token-summary th,
.mc-token-summary td {
    color: #00ff88 !important;
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    padding: 10px 0;
}
.mc-token-summary-total th,
.mc-token-summary-total td {
    font-size: 16px;
}
.mc-token-summary-balance th {
    color: #b0b0b0 !important;
}
.mc-token-summary-balance td .mc-price-tokens {
    color: #ffffff;
}
.mc-token-summary-after th {
    color: #b0b0b0 !important;
}
.mc-token-summary-after td .mc-price-tokens {
    color: #00ff88;
}
.mc-token-summary-insufficient td {
    color: #ff6b6b !important;
}
.mc-token-summary small {
    color: #b0b0b0;
}

/* Checkout token button */
.mc-checkout-token-btn {
    background: linear-gradient(135deg, #00ff88 0%, #39ff14 100%) !important;
    color: #000 !important;
    font-weight: 700 !important;
    border: none !important;
}
.mc-checkout-token-btn:hover {
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4) !important;
}

/* ── Fase 6.8: Order display tokens ─────────────────── */

/* Token price inside WC order tables (thank-you, view-order, order list) */
.woocommerce-table--order-details .mc-price-tokens,
.woocommerce-order-details .mc-price-tokens,
.woocommerce-orders-table .mc-price-tokens {
    font-size: 1em;
}

/* WC notices on archive/shop page */
.woocommerce-products-header + .woocommerce-error,
.woocommerce-products-header + .woocommerce-message,
.woocommerce-products-header + .woocommerce-info,
.woocommerce-notices-wrapper {
    margin-bottom: 1.5rem;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .mc-header-wallet {
        gap: 6px;
        margin-right: 6px;
    }
    .mc-header-balance {
        font-size: 11px;
    }
    .mc-header-buy-credits {
        font-size: 10px;
        padding: 4px 8px;
    }
}
