/* ═══════════════════════════════════════════════════════════
   Nexo Admin — Pure CSS
   Dark luxury theme with gold accents
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital@0;1&display=swap');

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

:root {
    --bg:       #0A0A0B;
    --surface:  #141416;
    --border:   #262629;
    --gold:     #D4AF37;
    --white:    #FFFFFF;
    --muted:    #8E8E93;
    --danger:   #FF453A;
    --radius:   8px;
    --radius-lg: 16px;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
}

html { font-size: 15px; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--white);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ─── Layout Shell ───────────────────────────────────── */
.app-shell   { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 40px 24px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
}
.sidebar-brand {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.6rem;
    margin-bottom: 60px;
    letter-spacing: -0.5px;
}
.sidebar-nav        { flex: 1; display: flex; flex-direction: column; gap: 24px; }
.sidebar-nav a      { display: flex; align-items: center; gap: 12px; font-size: .93rem; color: var(--muted); transition: color .2s; }
.sidebar-nav a:hover,
.sidebar-nav a.active { color: var(--white); }
.sidebar-nav a svg  { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-logout {
    margin-top: auto;
    padding-top: 24px;
}
.sidebar-logout a {
    display: flex; align-items: center; gap: 12px;
    font-size: .93rem; color: var(--muted); transition: color .2s;
    background: none; border: none; cursor: pointer; font-family: inherit;
}
.sidebar-logout a:hover { color: var(--danger); }

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 40px 60px;
    min-height: 100vh;
    overflow-y: auto;
}

/* ─── Mobile Top Bar ─────────────────────────────────── */
.mobile-bar {
    display: none;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky; top: 0; z-index: 100;
}
.mobile-bar .brand { font-family: var(--font-serif); font-style: italic; font-size: 1.25rem; }
.mobile-menu-toggle {
    background: none; border: none; color: var(--muted); cursor: pointer;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
}
.mobile-menu-toggle:hover { color: var(--white); background: var(--border); }

/* ─── Mobile Dropdown Menu ──────────────────────────── */
.mobile-menu {
    display: none;
    position: fixed;
    top: 56px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    z-index: 99;
    flex-direction: column;
    box-shadow: 0 16px 32px rgba(0,0,0,.5);
    max-height: calc(100vh - 56px);
    overflow-y: auto;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    font-size: .93rem; color: var(--muted);
    transition: background .15s, color .15s;
}
.mobile-menu a:hover, .mobile-menu a.active {
    color: var(--white); background: var(--border);
}
.mobile-menu a.active { color: var(--gold); }
.mobile-menu a svg { width: 18px; height: 18px; flex-shrink: 0; }
.mobile-menu-divider {
    height: 1px; background: var(--border); margin: 8px 16px;
}
.mobile-menu-user {
    padding: 8px 20px; font-size: .73rem; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px;
}
.mobile-menu-logout { color: var(--danger) !important; }
.mobile-menu-logout:hover { background: rgba(255,69,58,.1) !important; }

@media (max-width: 768px) {
    .sidebar       { display: none; }
    .mobile-bar    { display: flex; }
    .main-content  { margin-left: 0; padding: 24px 16px; }
    .page-header h1 { font-size: 1.5rem; }
}

/* ─── Page Header ────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 2.1rem;
    font-weight: 300;
    letter-spacing: -1px;
}

/* ─── Cards ──────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-body  { padding: 32px; }

.stat-card .stat-number {
    font-size: 3.2rem;
    font-weight: 200;
    margin-bottom: 8px;
}
.stat-card .stat-label {
    font-size: .73rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.quick-access {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}
.quick-access p { color: var(--muted); font-size: .93rem; }

.grid-2 { display: grid; grid-template-columns: 200px 1fr; gap: 30px; }

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card .stat-number { font-size: 2rem; }
    .card-body { padding: 20px; }
    .search-bar { width: 100%; }
}

/* ─── Table / List ───────────────────────────────────── */
.data-list {
    background: var(--border);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.data-list-header {
    background: var(--surface);
    padding: 16px 24px;
    display: grid;
    grid-template-columns: 1fr 2fr 1.5fr 1fr auto;
    align-items: center;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 500;
}
.data-row {
    background: var(--surface);
    padding: 18px 24px;
    display: grid;
    grid-template-columns: 1fr 2fr 1.5fr 1fr auto;
    align-items: center;
    font-size: .93rem;
    gap: 16px;
}
.data-row .name   { font-weight: 500; }
.data-row .sub    { color: var(--muted); font-size: .8rem; }
.data-row .status {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .73rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--border);
    color: var(--gold);
}
.data-row .actions {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    align-items: center;
}

@media (max-width: 768px) {
    .data-list-header { display: none; }
    .data-row {
        grid-template-columns: 1fr !important;
        padding: 16px;
        gap: 8px;
    }
    .data-row .actions {
        justify-content: flex-start;
        flex-wrap: wrap;
        padding-top: 8px;
        border-top: 1px solid var(--border);
        margin-top: 4px;
    }
}

/* ─── Pago Cards (mobile-first) ─────────────────────── */
.pago-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pago-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.pago-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.pago-card-header .name { font-weight: 500; font-size: 1rem; }
.pago-card-header .sub  { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.pago-card-valor {
    color: #34c759;
    font-weight: 600;
    font-size: .93rem;
    white-space: nowrap;
}
.pago-card-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 12px;
}
.pago-card-info span { display: inline-flex; align-items: center; gap: 4px; }
.pago-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* WhatsApp button */
.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: #25D366;
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    border: none;
    cursor: pointer;
    transition: opacity .2s;
}
.btn-whatsapp:hover { opacity: .85; color: #fff; }
.btn-whatsapp svg { width: 16px; height: 16px; }

/* ─── Section Label ──────────────────────────────────── */
.section-label {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin-bottom: 20px;
}

/* ─── Forms ──────────────────────────────────────────── */
.form-section {
    margin-bottom: 40px;
}
.form-section:last-child { margin-bottom: 0; }
.form-section-title {
    font-size: 1.07rem;
    color: var(--gold);
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.col-span-2  { grid-column: span 2; }
.col-span-3  { grid-column: span 3; }

@media (max-width: 1024px) {
    .form-grid   { grid-template-columns: repeat(2, 1fr); }
    .col-span-3  { grid-column: span 2; }
}
@media (max-width: 640px) {
    .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
    .col-span-2, .col-span-3 { grid-column: span 1; }
}

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 500;
}
.form-group label .req { color: var(--danger); }

.form-control {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--white);
    padding: 14px;
    font-size: 1rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
}
.form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold);
}
.form-control.is-invalid {
    border-color: var(--danger);
}
.form-control option { background: var(--surface); }

.field-error {
    font-size: .73rem;
    color: var(--danger);
    letter-spacing: .3px;
}

/* Dependente sub-cards */
.dep-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    grid-column: 1 / -1;
}
.dep-card h4 {
    font-size: .87rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 16px;
}
.dep-card .form-grid { grid-template-columns: repeat(3, 1fr); }

/* Form footer */
.form-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

/* ─── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: .87rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    cursor: pointer;
    border: none;
    transition: opacity .2s, background .2s, color .2s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--gold);
    color: var(--bg);
}
.btn-primary:hover { opacity: .9; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
}
.btn-outline:hover {
    background: var(--gold);
    color: var(--bg);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    padding: 6px 10px;
    text-transform: uppercase;
    font-size: .8rem;
    letter-spacing: .5px;
}
.btn-ghost:hover       { color: var(--gold); }
.btn-ghost-danger:hover { color: var(--danger); }

.btn-sm { padding: 6px 12px; font-size: .8rem; }

/* ─── Search Bar ─────────────────────────────────────── */
.search-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 320px;
    max-width: 100%;
}
.search-bar svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.search-bar input {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: .93rem;
    outline: none;
    width: 100%;
    font-family: var(--font-sans);
}
.search-bar input::placeholder { color: var(--muted); }

/* ─── Flash Messages ─────────────────────────────────── */
.flash {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: .93rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.flash-success {
    background: rgba(52,199,89,.1);
    border: 1px solid rgba(52,199,89,.3);
    color: #34c759;
}
.flash-error {
    background: rgba(255,69,58,.1);
    border: 1px solid rgba(255,69,58,.3);
    color: var(--danger);
}

/* ─── Login Page ─────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 16px;
}
.login-page .brand {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 2.1rem;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    text-align: center;
}
.login-page .subtitle {
    color: var(--muted);
    font-size: .93rem;
    margin-bottom: 32px;
    text-align: center;
}
.login-box {
    width: 100%;
    max-width: 420px;
}
.login-box .card-body { display: flex; flex-direction: column; gap: 24px; }
.login-hint {
    font-size: .73rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(142,142,147,.5);
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ─── Empty State ────────────────────────────────────── */
.empty-state {
    padding: 48px;
    text-align: center;
    color: var(--muted);
    font-size: .93rem;
}

/* ─── Back Button ────────────────────────────────────── */
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    transition: background .2s, color .2s;
    margin-right: 12px;
}
.btn-back:hover { background: var(--border); color: var(--white); }

/* ─── Utilities ──────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-sm    { font-size: .87rem; }
.text-xs    { font-size: .73rem; }
.mt-auto    { margin-top: auto; }
.mb-4       { margin-bottom: 16px; }
.mb-10      { margin-bottom: 40px; }
.gap-10     { gap: 40px; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Responsive filter buttons ─────────────────────── */
@media (max-width: 768px) {
    .section-label { font-size: .73rem; letter-spacing: 1px; flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
    .section-label > div { width: 100%; }
    .section-label > div > div { flex-wrap: wrap !important; }
    .btn-sm { padding: 6px 10px; font-size: .73rem; }
    .form-footer { padding: 16px; justify-content: stretch; }
    .form-footer .btn { flex: 1; min-width: 0; text-align: center; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
}
