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

:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #8b5cf6;
    --accent: #10b981;
    --bg-main: #020617;
    --sidebar-bg: rgba(15, 23, 42, 0.8);
    --card-bg: rgba(30, 41, 59, 0.5);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Glassmorphism Effect */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Sidebar */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.nav-item i {
    width: 20px;
    margin-right: 1rem;
    font-size: 1.1rem;
}

.nav-label {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 1.5rem 0 0.5rem 0.5rem;
    padding: 0.5rem;
    opacity: 0.6;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.3s, opacity 0.3s;
}

.nav-label:hover, .nav-label.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.nav-label.active i {
    transform: rotate(180deg);
}

.nav-group {
    display: none;
    flex-direction: column;
    padding-left: 0.5rem;
}

.nav-group-expanded {
    display: flex;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    padding: 1.75rem;
    transition: transform 0.3s ease;
}

.stat-card:hover { transform: translateY(-5px); }

.stat-card .label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .value {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 0.75rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.charts-grid.full { grid-template-columns: 1fr; }
.charts-grid.tri { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Compact Tables for Grid Views */
.compact-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}
.compact-table th {
    font-size: 0.75rem;
}

/* Modal and Tooltip Adjustments */
.detail-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2000;
}

.chart-card {
    padding: 2rem;
    min-height: 400px;
}

.chart-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

/* Tables */
.table-container {
    padding: 1.5rem;
    margin-top: 2rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

th {
    padding: 1rem;
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    resize: horizontal;
    overflow: auto;
}

td {
    padding: 1.25rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.9375rem;
}

tr td:first-child { border-radius: 0.75rem 0 0 0.75rem; }
tr td:last-child { border-radius: 0 0.75rem 0.75rem 0; }

tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

/* Inputs & Buttons */
.date-input, select {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    outline: none;
    font-family: inherit;
    transition: all 0.3s;
}

.date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-badge.pending { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.status-badge.pending::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.status-badge.approved, .status-badge.approvedBase { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.status-badge.approved::before, .status-badge.approvedBase::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px #10b981; }
.status-badge.declined { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.status-badge.declined::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; }

/* Modal Overhaul */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.5rem;
    padding: 0.5rem;
}
.modal-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    padding: 1.5rem;
}
.modal-card h4 {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 600;
}
.kv-list { display: flex; flex-direction: column; gap: 0.75rem; }
.kv-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; }
.kv-label { color: var(--text-muted); }
.kv-value { color: var(--text-main); font-weight: 500; }

/* Timeline */
.timeline-container { position: relative; padding-left: 2rem; }
.timeline-container::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.05); }
.t-item { position: relative; margin-bottom: 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.t-dot { position: absolute; left: -2rem; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--bg-main); background: #334155; transform: translateX(2px); z-index: 1; }
.t-item.active .t-dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.t-label { font-size: 0.875rem; color: var(--text-muted); }
.t-item.active .t-label { color: var(--text-main); font-weight: 600; }
.t-date { font-size: 0.75rem; color: var(--text-muted); }

/* Conversion Visualization */
.conv-box { display: flex; align-items: center; justify-content: space-between; padding: 2rem; background: rgba(255,255,255,0.02); border-radius: 1rem; margin-top: 1rem; }
.conv-node { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.75rem; }
.conv-node i { font-size: 1.5rem; color: var(--text-main); }
.conv-line { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, #334155, #334155 4px, transparent 4px, transparent 8px); margin: 0 1rem; position: relative; }
.conv-time { position: absolute; top: -1.25rem; left: 50%; transform: translateX(-50%); color: var(--text-muted); font-size: 0.7rem; }

/* List UI Headers */
.review-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
}
.stat-tag {
    background: white;
    color: #1e293b;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stat-tag span { background: #f1f5f9; padding: 0.125rem 0.625rem; border-radius: 99px; font-size: 0.75rem; }
.stat-link { color: #6366f1; font-weight: 600; font-size: 0.875rem; text-decoration: none; }

/* Progress Animation */
#sync-progress {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 1rem;
}

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

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

/* Tooltip/Modal Detail Improvements */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: #0b1121;
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--text-main);
}

.raw-json {
    background: #020617;
    padding: 1.5rem;
    border-radius: 0.75rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.8125rem;
    overflow-x: auto;
    max-height: 300px;
    color: #94a3b8;
    border: 1px solid var(--glass-border);
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    animation: fadeIn 0.5s ease forwards;
}

/* Auth Pages Styling - Premium Upgrade */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: url('../img/auth_background.png') center/cover no-repeat;
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, transparent 0%, rgba(2, 6, 23, 0.4) 100%);
    pointer-events: none;
}

.auth-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    padding: 4rem 3rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    z-index: 10;
    animation: authSlideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authSlideIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-size: 0.9375rem;
}

.form-group {
    margin-bottom: 2rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: color 0.3s;
    font-size: 1rem;
}

.form-group input {
    width: 100%;
    background: rgba(2, 6, 23, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1rem 1rem 1rem 3.25rem;
    color: white;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
}

.form-group input:focus {
    background: rgba(2, 6, 23, 0.6);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    outline: none;
}

.form-group input:focus + i {
    color: var(--primary);
}

.auth-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    padding: 1.125rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px var(--primary-glow);
    margin-top: 1rem;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px var(--primary-glow);
    filter: brightness(1.1);
}

.auth-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: var(--secondary);
}

.error-msg {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 1rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Pagination & Filter Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    width: 300px;
    outline: none;
    font-family: inherit;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.page-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}
/* Report Grid & KPIs */
.report-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.kpi-card .label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.kpi-card .value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.chart-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    flex: 1;
    min-height: 400px;
}

.measure-dropdown {
    position: relative;
    display: inline-block;
}

.measure-content {
    display: none;
    position: absolute;
    background: #1e293b;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
}

.measure-content.show {
    display: block;
}

.measure-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    color: var(--text-main);
    font-size: 0.875rem;
    cursor: pointer;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design */
.mobile-menu-btn {
    display: none !important;
    font-size: 1.25rem;
    padding: 0.5rem 0.75rem;
}

.mobile-sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 900;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: block !important;
    }

    .main-content {
        padding: 1.5rem 1rem;
        width: 100%;
        max-width: 100vw;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .header > div {
        flex-wrap: wrap;
    }

    .report-grid {
        grid-template-columns: 1fr;
    }

    .kpi-column {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr !important;
    }
    
    .kpi-column {
        grid-template-columns: 1fr;
    }

    .form-group, .date-input {
        width: 100%;
    }
}
