﻿/* ============================================
   LEDGIFY PRO - PREMIUM DARK NAVY THEME v6
   ============================================ */

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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1a2847;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent: #38bdf8;
    --accent-dark: #0284c7;
    --success: #10b981;
    --danger: #ef4444;
    --border: #334155;
    --card-bg: rgba(30, 41, 59, 0.88);
    --glass-light: rgba(255, 255, 255, 0.06);
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* ============ APP SHELL ============ */

.app-shell {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar-wrapper {
    display: flex;
}

/* ============ SIDEBAR ============ */

.sidebar {
    width: 240px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.22);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding: 12px;
    background: var(--glass-light);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
}

.brand-name {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.brand-name b {
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 15px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: inherit;
}

.nav-item:hover {
    background: var(--glass-light);
    border-color: var(--accent);
    color: var(--accent);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    border-color: var(--accent);
    box-shadow: 0 5px 18px rgba(56, 189, 248, 0.24);
}

.nav-item .icon {
    font-size: 16px;
}

.sidebar-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trust-pill {
    background: var(--glass-light);
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--success);
    text-align: center;
    font-weight: 700;
}

.btn-reset {
    padding: 12px 14px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
    border-radius: var(--radius);
    color: #fecaca;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #fca5a5;
}

/* ============ WORKSPACE ============ */

.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============ CLIENT SWITCHER BAR ============ */

.client-switcher-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid var(--border);
}

.client-state {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.client-state span:first-child {
    color: var(--accent);
    font-weight: 700;
}

.client-switcher {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.client-switcher label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.client-selector {
    min-width: 220px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

/* ============ HEADER ============ */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.value-cards {
    display: flex;
    gap: 16px;
    flex: 1;
}

.v-card {
    flex: 1;
    min-width: 120px;
    flex-shrink: 0;
    padding: 18px;
    background: var(--glass-light);
    border: 1px solid rgba(56, 189, 248, 0.1);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.v-card:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.08);
}

.v-card.highlight {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(16, 185, 129, 0.09));
    border-color: var(--accent);
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.12);
}

.v-card label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 700;
}

.v-card span {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ============ BUTTONS ============ */

.btn-primary,
.btn-submit {
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.28);
    font-family: inherit;
}

.btn-primary:hover,
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35);
}

.btn-ghost {
    padding: 14px 18px;
    background: transparent;
    border: 1px solid var(--text-secondary);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ============ CONTENT AREA ============ */

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.tab-view {
    display: none;
}

.tab-view.active {
    display: block;
}

/* ============ SPLIT VIEW ============ */

.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.preview-panel,
.form-panel {
    display: flex;
    flex-direction: column;
}

/* ============ UPLOAD ZONE ============ */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--glass-light);
}

.upload-zone:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.08);
}

.upload-icon {
    font-size: 34px;
    margin-bottom: 12px;
}

.upload-zone h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.upload-zone p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============ CARD ============ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    backdrop-filter: blur(12px);
}

.viewer-card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 420px;
}

/* ============ FORM ============ */

.main-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.segmented-control {
    display: flex;
    background: var(--glass-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    gap: 4px;
}

.segmented-control input {
    display: none;
}

.segmented-control label {
    flex: 1;
    padding: 16px 18px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.segmented-control input:checked + label {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
}

.form-row,
.form-grid {
    display: flex;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label-tiny {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.field input,
.field select {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.08);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.16);
}

.field input::placeholder {
    color: var(--text-secondary);
}

/* ============ TABLE ============ */

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ledger-table thead {
    background: var(--glass-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ledger-table th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    color: var(--accent);
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.ledger-table td {
    padding: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ledger-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.ledger-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.08);
}

.text-right {
    text-align: right;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

.badge-sale {
    background: #0ea5e9;
}

.badge-purchase {
    background: #ef4444;
}

.badge-payment,
.badge-receipt {
    background: #22c55e;
}

/* ============ TOAST ============ */

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ============ LOADING OVERLAY ============ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.94);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    color: white;
    font-size: 14px;
    z-index: 2000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ MOBILE NAV ============ */

.mobile-bottom-nav {
    display: none;
}

.mobile-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 14px 10px;
    flex: 1;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.mobile-nav-btn.active,
.mobile-nav-btn:hover {
    color: var(--accent);
}

.mobile-nav-btn.active {
    background: rgba(56, 189, 248, 0.08);
}

.clients-card {
    min-height: 280px;
}

/* ============ UTILITY ============ */

.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

h2, h3, h4 {
    margin: 0;
    font-weight: 700;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 16px;
}

h4 {
    font-size: 14px;
}

/* ============ SCROLLBAR ============ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1200px) {
    .split-view {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .client-switcher-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .client-state {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .app-shell {
        flex-direction: column;
        min-height: 100vh;
    }

    .sidebar-wrapper,
    .sidebar {
        display: none;
    }

    .workspace {
        width: 100%;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
    }

    .value-cards {
        flex-direction: column;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        justify-content: space-around;
        align-items: center;
        background: rgba(15, 23, 42, 0.98);
        border-top: 1px solid var(--border);
        z-index: 1500;
        padding: 4px 0;
    }

    .content-area {
        padding-bottom: 90px;
    }

    .segmented-control label {
        padding: 18px 16px;
        font-size: 14px;
    }

    .field input,
    .field select {
        padding: 16px 18px;
    }

    .btn-submit,
    .btn-primary,
    .btn-ghost {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .header-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}
