/* Portal de clientes — hoja de estilos */

:root {
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --success:       #16a34a;
    --warning:       #d97706;
    --danger:        #dc2626;
    --bg:            #f1f5f9;
    --bg-card:       #ffffff;
    --border:        #e2e8f0;
    --text:          #1e293b;
    --text-muted:    #64748b;
    --header-bg:     #1e293b;
    --header-h:      60px;
    --radius:        10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────── */
.portal-header {
    background: var(--header-bg);
    color: #fff;
    height: var(--header-h);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,.25);
}
.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.header-brand i { color: #60a5fa; font-size: 18px; }

.header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.header-nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 13px;
    transition: background .15s, color .15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.header-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: auto;
}

/* Botón hamburguesa (solo visible en móvil) */
.nav-toggle {
    display: none;
    margin-left: auto;
    background: transparent;
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.btn-logout {
    color: #fca5a5;
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid #7f1d1d;
    border-radius: 7px;
    font-size: 12px;
    transition: background .15s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-logout:hover { background: #7f1d1d; color: #fff; }

/* ── Header responsivo (móvil) ────────────────── */
@media (max-width: 768px) {
    .header-inner { gap: 12px; }

    .nav-toggle { display: flex; }

    /* El nav se convierte en un panel desplegable bajo el header */
    .header-nav {
        display: none;
        flex-direction: column;
        gap: 2px;
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: var(--header-bg);
        padding: 8px 12px 14px;
        box-shadow: 0 6px 14px rgba(0,0,0,.3);
        border-top: 1px solid rgba(255,255,255,.08);
    }
    .header-nav.open { display: flex; }

    .header-nav a {
        font-size: 15px;
        padding: 12px 14px;
    }

    .header-user {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-left: 0;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,.12);
    }
    .header-user span { padding: 0 14px; }
    .btn-logout { justify-content: center; padding: 10px 12px; font-size: 14px; }
}

/* ── Main ─────────────────────────────────────── */
.portal-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px;
    flex: 1;
    width: 100%;
}

/* ── Footer ───────────────────────────────────── */
.portal-footer {
    text-align: center;
    padding: 14px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

/* ── Card ─────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 20px; }

/* ── Page header ──────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Alerts ───────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Table ────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.portal-table {
    width: 100%;
    border-collapse: collapse;
}
.portal-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.portal-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.portal-table tbody tr:last-child td { border-bottom: none; }
.portal-table tbody tr:hover { background: #f8fafc; }

/* ── Badges ───────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* ── Parcialidades ────────────────────────────── */
.plan-resumen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    text-align: center;
}
.plan-resumen-valor { font-size: 20px; font-weight: 700; }
.plan-resumen-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.progress-wrap {
    height: 10px;
    border-radius: 5px;
    background: var(--border);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 5px;
    background: var(--success);
    transition: width .3s;
}

/* ── Small action button ──────────────────────── */
.btn-sm-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
    text-decoration: none;
    transition: background .15s;
    white-space: nowrap;
}
.btn-sm-action:hover { background: #dbeafe; }

/* ── Empty state ──────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { margin-bottom: 14px; display: block; }
.empty-state p { font-size: 15px; }

/* ── Forms ────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; display: block; }

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s, border-color .15s;
    font-family: inherit;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }

/* Input con ícono de ojo */
.input-eye {
    position: relative;
}
.input-eye .form-control { padding-right: 40px; }
.eye-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
}
.eye-btn:hover { color: var(--text); }

/* ── Login ────────────────────────────────────── */
body.login-body {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-brand i {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 10px;
    display: block;
}
.login-brand h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.login-brand p { font-size: 13px; color: var(--text-muted); }

.btn-primary-full {
    width: 100%;
    padding: 11px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    transition: background .15s;
}
.btn-primary-full:hover { background: var(--primary-dark); }

/* ── Section divider ──────────────────────────── */
.section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Aviso de saldo a favor (parte superior de Mis Recibos) */
.saldo-favor-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    border-radius: 12px;
    padding: 18px 24px;
    margin-bottom: 20px;
    box-shadow: 0 6px 18px rgba(22,163,74,.28);
}
.saldo-favor-icon {
    font-size: 40px;
    flex-shrink: 0;
    opacity: .95;
}
.saldo-favor-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.saldo-favor-label {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    opacity: .95;
}
.saldo-favor-monto {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -.5px;
}
.saldo-favor-nota {
    font-size: 13px;
    opacity: .9;
}
@media (max-width: 520px) {
    .saldo-favor-icon  { font-size: 32px; }
    .saldo-favor-monto { font-size: 32px; }
}
