/* ═══════════════════════════════════════════════════
   AVS Invoice — Design System
   Font: Inter (Google Fonts)
   Palette: Deep Navy + Indigo/Violet + Teal
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Tokens ─────────────────────────────────────── */
:root {
    /* Brand */
    --brand:        #6366f1;
    --brand-dark:   #4f46e5;
    --brand-light:  #e0e7ff;
    --teal:         #14b8a6;
    --teal-light:   #ccfbf1;

    /* Surface */
    --ink:          #0f172a;
    --ink-2:        #1e293b;
    --muted:        #64748b;
    --muted-2:      #94a3b8;
    --line:         #e2e8f0;
    --line-2:       #f1f5f9;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;
    --page:         #f1f5f9;

    /* Nav */
    --nav-bg:       #0f172a;
    --nav-height:   64px;

    /* Status */
    --paid-bg:      #dcfce7; --paid-fg:     #15803d;
    --unpaid-bg:    #fef3c7; --unpaid-fg:   #b45309;
    --quote-bg:     #dbeafe; --quote-fg:    #1d4ed8;

    /* Radius & shadow */
    --r-sm:  6px;
    --r:     10px;
    --r-lg:  16px;
    --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --shadow:    0 4px 16px rgba(15,23,42,.08), 0 1px 4px rgba(15,23,42,.04);
    --shadow-lg: 0 10px 40px rgba(15,23,42,.12), 0 4px 12px rgba(15,23,42,.06);
}

/* ── Reset / Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--page);
    color: var(--ink);
    font-size: .925rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Page-enter animation ───────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
main { animation: fadeUp .35s ease both; }


/* ══════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════ */
.app-nav {
    background: var(--nav-bg);
    height: var(--nav-height);
    padding: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 2px 16px rgba(0,0,0,.25);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-nav .navbar-brand {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -.3px;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0 0 4px;
}

.app-nav .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--teal) 100%);
    border-radius: var(--r-sm);
    display: grid;
    place-items: center;
    font-size: .85rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(99,102,241,.25);
}

.app-nav .nav-link {
    color: rgba(255,255,255,.65) !important;
    font-weight: 500;
    font-size: .875rem;
    padding: 6px 14px !important;
    border-radius: var(--r-sm);
    transition: color .18s, background .18s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-nav .nav-link:hover,
.app-nav .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,.08);
}

.app-nav .nav-link.active {
    background: rgba(99,102,241,.25);
    color: #a5b4fc !important;
}

.app-nav .nav-link i { font-size: 1rem; }

.app-nav .nav-divider {
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,.12);
    margin: 0 6px;
}

/* logout button styled as nav-link */
.app-nav .btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,.65) !important;
    font-weight: 500;
    font-size: .875rem;
    padding: 6px 14px;
    border-radius: var(--r-sm);
    transition: color .18s, background .18s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}
.app-nav .btn-logout:hover {
    color: #fff !important;
    background: rgba(239,68,68,.15);
}

/* nav user avatar badge */
.app-nav .nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--teal) 100%);
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-size: .7rem;
    font-weight: 800;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.2);
}

/* ── Dismissible Alerts (Bootstrap override) ──── */
.alert {
    font-size: .875rem;
    font-weight: 500;
    animation: fadeUp .3s ease both;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
}
.alert-success .btn-close { filter: invert(30%) sepia(1) saturate(3) hue-rotate(95deg); }
.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}
.alert-danger .btn-close { filter: invert(20%) sepia(1) saturate(5) hue-rotate(330deg); }

/* ── Page header ─────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.page-header-left .page-eyebrow {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 2px;
}
.page-header-left h1 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0;
    letter-spacing: -.3px;
}


/* ══════════════════════════════════════════════════
   CARDS / PANELS
══════════════════════════════════════════════════ */
.content-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* ── Metric / Stat Cards ──────────────────────────── */
.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .22s ease, box-shadow .22s ease;
    overflow: hidden;
    position: relative;
}
.metric:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.metric::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    background: linear-gradient(135deg, rgba(99,102,241,.04) 0%, transparent 60%);
    transition: opacity .22s;
}
.metric:hover::after { opacity: 1; }

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 1.4rem;
}
.metric-icon.indigo  { background: var(--brand-light);  color: var(--brand-dark); }
.metric-icon.teal    { background: var(--teal-light);   color: #0f766e; }
.metric-icon.amber   { background: #fef3c7;             color: #b45309; }
.metric-icon.rose    { background: #fee2e2;             color: #be123c; }

.metric-body { flex: 1; min-width: 0; }
.metric-label {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 3px;
}
.metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ══════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════ */
.table {
    --bs-table-hover-bg: #f8fafc;
    font-size: .875rem;
    margin-bottom: 0;
}
.table thead th {
    background: var(--surface-2);
    border-bottom: 2px solid var(--line);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 10px 14px;
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    border-color: var(--line-2);
    vertical-align: middle;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: var(--surface-2); }

/* empty state */
.table-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.table-empty i { font-size: 2.4rem; display: block; margin-bottom: 10px; opacity: .35; }
.table-empty p { margin: 0; font-size: .9rem; }

/* ── Status Badges ──────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.status-paid      { background: var(--paid-bg);   color: var(--paid-fg); }
.status-unpaid    { background: var(--unpaid-bg); color: var(--unpaid-fg); }
.status-quotation { background: var(--quote-bg);  color: var(--quote-fg); }

/* ── Client Avatar ─────────────────────────────── */
.client-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--teal) 100%);
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .03em;
    flex-shrink: 0;
}

/* ── Action Buttons ──────────────────────────────── */
.btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    display: inline-grid;
    place-items: center;
    font-size: .9rem;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
    transition: color .15s, background .15s, border-color .15s, transform .12s;
    cursor: pointer;
}
.btn-action:hover { transform: scale(1.1); }
.btn-action.view:hover   { background: var(--surface-2); color: var(--ink); border-color: #cbd5e1; }
.btn-action.print:hover  { background: var(--ink-2); color: #fff; border-color: var(--ink-2); }
.btn-action.edit:hover   { background: var(--brand);  color: #fff; border-color: var(--brand); }
.btn-action.delete:hover { background: #ef4444;        color: #fff; border-color: #ef4444; }


/* ══════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════ */
.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: .85rem;
    border-radius: var(--r-sm);
    transition: transform .12s, box-shadow .15s, background .18s, border-color .18s;
}
.btn:active { transform: scale(.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-dark) 0%, #4338ca 100%);
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(99,102,241,.45);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.3);
}
.btn-success:hover { border-color: transparent; color: #fff; }

.btn-outline-secondary {
    border-color: var(--line);
    color: var(--muted);
}
.btn-outline-secondary:hover {
    background: var(--surface-2);
    border-color: #cbd5e1;
    color: var(--ink);
}

/* Pill variant */
.btn-pill { border-radius: 99px; padding-left: 18px; padding-right: 18px; }


/* ══════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════ */
.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 5px;
    letter-spacing: .01em;
}
.form-control, .form-select {
    border-color: var(--line);
    border-radius: var(--r-sm);
    font-size: .875rem;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .18s, box-shadow .18s;
    font-family: 'Inter', sans-serif;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control::placeholder { color: var(--muted-2); }

textarea.form-control { resize: vertical; }

/* ── Invoice form specifics ──────────────────────── */
.form-panel { max-width: 1000px; }

.form-section-header {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-section-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

.qty-col   { width: 100px; }
.money-col { width: 150px; }
.icon-col  { width: 50px; }

/* ── Totals Box ──────────────────────────────────── */
.totals-box {
    background: linear-gradient(145deg, #f8faff 0%, #eef2ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: 0 2px 12px rgba(99,102,241,.08);
}
.totals-box > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #dde4ff;
}
.totals-box > div:last-child { border-bottom: 0; }
.totals-box span { font-size: .82rem; color: var(--muted); font-weight: 500; }
.totals-box input {
    max-width: 160px;
    text-align: right;
}
.totals-box .grand {
    padding-top: 14px;
    margin-top: 2px;
}
.totals-box .grand span {
    font-size: .9rem;
    font-weight: 700;
    color: var(--ink);
}
.totals-box .grand strong {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--brand-dark);
    letter-spacing: -.4px;
}


/* ══════════════════════════════════════════════════
   FORM PANELS (clients/company)
══════════════════════════════════════════════════ */
.page-form-panel {
    max-width: 760px;
    margin: 0 auto;
}
.form-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.form-card-header .icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: var(--r);
    background: var(--brand-light);
    color: var(--brand-dark);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.form-card-header h1 { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--ink); }
.form-card-header p  { font-size: .8rem; color: var(--muted); margin: 2px 0 0; }


/* ══════════════════════════════════════════════════
   RECEIPT / INVOICE PREVIEW
══════════════════════════════════════════════════ */
.receipt-page {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 36px 40px;
    max-width: 920px;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

.invoice-logo {
    max-width: 120px;
    max-height: 90px;
    object-fit: contain;
}

.invoice-logo-fallback {
    width: 80px;
    height: 80px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand) 0%, var(--teal) 100%);
    color: #fff;
    border-radius: var(--r);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: .05em;
}

.invoice-strip {
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
    color: rgba(255,255,255,.9);
    border-radius: var(--r);
    padding: 14px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    align-items: center;
    margin-bottom: 24px;
    font-size: .875rem;
}
.invoice-strip strong { color: #fff; }

.receipt-table th,
.receipt-table td { vertical-align: middle; }

.receipt-table thead th {
    background: var(--surface-2);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}


/* ══════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════ */
.login-body {
    min-height: 100vh;
    background: var(--ink);
    overflow: hidden;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* Left branding panel */
.login-brand-panel {
    background: linear-gradient(145deg, #1e1b4b 0%, #312e81 40%, #1e3a5f 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 48px;
    position: relative;
    overflow: hidden;
}
.login-brand-panel::before {
    content: '';
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,.35) 0%, transparent 70%);
    top: -120px; right: -120px;
    pointer-events: none;
}
.login-brand-panel::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20,184,166,.2) 0%, transparent 70%);
    bottom: -80px; left: -80px;
    pointer-events: none;
}
.login-brand-icon {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,.12);
    border: 2px solid rgba(255,255,255,.2);
    backdrop-filter: blur(8px);
    border-radius: var(--r-lg);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 32px;
    letter-spacing: -.02em;
}
.login-brand-panel h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 12px;
    letter-spacing: -.5px;
    line-height: 1.2;
}
.login-brand-panel p {
    color: rgba(255,255,255,.65);
    font-size: 1rem;
    margin: 0 0 40px;
    line-height: 1.7;
}
.login-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,.8);
    font-size: .9rem;
    font-weight: 500;
}
.login-features li i {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,.1);
    border-radius: var(--r-sm);
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: #a5b4fc;
    flex-shrink: 0;
}

/* Right login panel */
.login-right {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}
.login-panel {
    width: 100%;
    max-width: 400px;
}
.login-panel-header {
    margin-bottom: 32px;
}
.login-panel-header h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 6px;
    letter-spacing: -.4px;
}
.login-panel-header p {
    color: var(--muted);
    font-size: .9rem;
    margin: 0;
}

.login-form { display: grid; gap: 18px; }

@media (max-width: 767px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
    .login-right { padding: 32px 20px; }
}


/* ══════════════════════════════════════════════════
   PRINT
══════════════════════════════════════════════════ */
.print-body { background: #eee; }

@media print {
    .no-print { display: none !important; }
    body, .print-body { background: #fff; font-family: 'Inter', sans-serif; }
    .app-nav { display: none !important; }
    .receipt-page { border: 0; box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
    .invoice-strip {
        background: #1e293b !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}


/* ══════════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════════ */
.pagination { gap: 4px; }
.page-link {
    border-radius: var(--r-sm) !important;
    border-color: var(--line);
    color: var(--muted);
    font-size: .8rem;
    font-weight: 500;
    padding: 6px 12px;
    transition: background .15s, color .15s;
}
.page-link:hover { background: var(--brand-light); color: var(--brand-dark); border-color: #c7d2fe; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-item.disabled .page-link { color: var(--muted-2); }


/* ══════════════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════════════ */
.text-muted { color: var(--muted) !important; }
.section-divider {
    height: 1px;
    background: var(--line);
    margin: 24px 0;
}

/* Input group new-client button */
.input-group .btn-outline-success {
    border-color: var(--line);
    color: #059669;
    background: #f0fdf4;
    transition: background .15s, color .15s;
}
.input-group .btn-outline-success:hover {
    background: #059669;
    color: #fff;
    border-color: #059669;
}