/* ═══════════════════════════════════════════════
   CLIENTE DASHBOARD - PREMIUM REDESIGN
   Mobile-first · Dark Cards · Glassmorphism
   ═══════════════════════════════════════════════ */

:root {
    --nav-height: 70px;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border: rgba(0, 0, 0, 0.07);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --blue:   #1976FF;
    --purple: #7C3AED;
    --green:  #059669;
    --orange: #EA580C;
    --pink:   #DB2777;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.10);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Poppins', 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: var(--nav-height);
}

/* ─── LAYOUT ─────────────────────────────────── */
.main-content {
    width: 100%;
    min-height: calc(100vh - var(--nav-height));
    padding: 20px 16px 40px;
}

.content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ─── HEADER ROW ─────────────────────────────── */
.dash-header-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dash-greeting-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.dash-greeting-name {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Saldo chip */
.saldo-chip {
    background: linear-gradient(135deg, #1d4ed8 0%, #4F8EF7 100%);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 8px 32px rgba(79, 142, 247, 0.3);
}

.saldo-chip-label {
    font-size: 0.75rem;
    opacity: 0.85;
    flex: 0 0 100%;
    letter-spacing: 0.5px;
}

.saldo-chip-amount {
    font-size: 1.5rem;
    font-weight: 800;
    flex: 1;
    letter-spacing: -0.5px;
}

.saldo-chip-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.saldo-chip-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ─── STATS GRID ─────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-blue::before   { background: linear-gradient(90deg, var(--blue), #60A5FA); }
.stat-purple::before { background: linear-gradient(90deg, var(--purple), #A78BFA); }
.stat-green::before  { background: linear-gradient(90deg, var(--green), #34D399); }
.stat-orange::before { background: linear-gradient(90deg, var(--orange), #FB923C); }

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-card-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-wrap svg { width: 20px; height: 20px; }

.stat-blue .stat-icon-wrap   { background: rgba(25, 118, 255, 0.10); color: var(--blue); }
.stat-purple .stat-icon-wrap { background: rgba(124, 58, 237, 0.10); color: var(--purple); }
.stat-green .stat-icon-wrap  { background: rgba(5, 150, 105, 0.10);  color: var(--green); }
.stat-orange .stat-icon-wrap { background: rgba(234, 88, 12, 0.10);  color: var(--orange); }

.stat-text { display: flex; flex-direction: column; gap: 2px; }

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.5px;
}

.stat-trend {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.stat-trend-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ─── NIVEL BANNER ───────────────────────────── */
.nivel-banner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nivel-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    pointer-events: none;
    opacity: 0.06;
}

.nivel-banner.nivel-basico::after     { background: #94a3b8; }
.nivel-banner.nivel-premium::after    { background: var(--blue); }
.nivel-banner.nivel-corporativo::after { background: var(--orange); }

.nivel-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }

.nivel-icon-wrap { font-size: 2rem; flex-shrink: 0; }

.nivel-info { flex: 1; min-width: 0; }

.nivel-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    background: rgba(25, 118, 255, 0.10);
    color: var(--blue);
}

.nivel-banner.nivel-corporativo .nivel-tag { background: rgba(234, 88, 12, 0.10); color: var(--orange); }
.nivel-banner.nivel-premium .nivel-tag     { background: rgba(25, 118, 255, 0.10); color: var(--blue); }
.nivel-banner.nivel-basico .nivel-tag      { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }

.nivel-progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.nivel-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--blue), #60A5FA);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.nivel-banner.nivel-corporativo .nivel-progress-fill {
    background: linear-gradient(90deg, var(--orange), #FB923C);
}

.nivel-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.nivel-right { flex-shrink: 0; }

.nivel-descuento {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(5, 150, 105, 0.10);
    border: 1px solid rgba(5, 150, 105, 0.20);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: var(--green);
}

.descuento-valor { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.descuento-label { font-size: 0.65rem; opacity: 0.8; margin-top: 2px; }

/* ─── CHARTS ROW ─────────────────────────────── */
.charts-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 18px;
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.chart-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-card-badge {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.chart-wrap {
    position: relative;
    height: 200px;
}

.chart-wrap-donut {
    height: 240px;
}

/* ─── QUICK ACTIONS ──────────────────────────── */
.quick-actions-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.qa-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Poppins', 'Inter', sans-serif;
}

.qa-btn:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    color: var(--text-primary);
}

.qa-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-icon svg { width: 18px; height: 18px; }

.qa-icon-blue   { background: rgba(25, 118, 255, 0.10); color: var(--blue); }
.qa-icon-purple { background: rgba(124, 58, 237, 0.10); color: var(--purple); }
.qa-icon-green  { background: rgba(5, 150, 105, 0.10);  color: var(--green); }
.qa-icon-orange { background: rgba(234, 88, 12, 0.10);  color: var(--orange); }
.qa-icon-pink   { background: rgba(219, 39, 119, 0.10); color: var(--pink); }

/* ─── TABLE CARD ─────────────────────────────── */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.table-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.table-card-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    transition: var(--transition);
}

.table-card-link:hover { color: #7BB8FF; }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 540px;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 18px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.87rem;
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover td {
    background: #f8fafc;
    color: var(--text-primary);
}

.guia-folio {
    color: var(--blue);
    font-size: 0.82rem;
    font-family: 'Courier New', monospace;
}

.table-empty {
    text-align: center;
    padding: 40px !important;
    color: var(--text-muted);
    font-size: 0.87rem;
}

/* ─── BADGES ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary   { background: rgba(25, 118, 255, 0.10);  color: var(--blue); }
.badge-success   { background: rgba(5, 150, 105, 0.10);   color: var(--green); }
.badge-warning   { background: rgba(234, 88, 12, 0.10);   color: var(--orange); }
.badge-danger    { background: rgba(220, 38, 38, 0.10);   color: #DC2626; }
.badge-info      { background: rgba(124, 58, 237, 0.10);  color: var(--purple); }
.badge-secondary { background: rgba(100, 116, 139, 0.10); color: var(--text-muted); }

/* ─── TABLE ACTION BTN ───────────────────────── */
.btn-table-action {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-table-action:hover {
    background: rgba(25, 118, 255, 0.10);
    color: var(--blue);
    border-color: rgba(25, 118, 255, 0.25);
}

/* ─── SIDEBAR HIDE ───────────────────────────── */
.sidebar, .topbar,
.sidebar-header, .sidebar-nav, .sidebar-footer {
    display: none !important;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — TABLET (≥ 640px)
   ═══════════════════════════════════════════════ */
@media (min-width: 640px) {
    .main-content { padding: 28px 24px 48px; }

    .dash-header-row {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .saldo-chip {
        flex-wrap: nowrap;
        min-width: 280px;
    }

    .saldo-chip-label { flex: 0 0 auto; }

    .stats-grid { grid-template-columns: repeat(4, 1fr); }

    .quick-actions-row { grid-template-columns: repeat(5, 1fr); }

    .charts-row { flex-direction: row; }

    .chart-card { flex: 1; }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — DESKTOP (≥ 1024px)
   ═══════════════════════════════════════════════ */
@media (min-width: 1024px) {
    .main-content { padding: 36px 40px 60px; }

    .dash-greeting-name { font-size: 2rem; }

    .saldo-chip-amount { font-size: 1.75rem; }

    .stat-value { font-size: 2rem; }

    .chart-wrap { height: 240px; }
    .chart-wrap-donut { height: 270px; }
}
