:root {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --border-glass: rgba(226, 232, 240, 0.9);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-primary: #6366f1; /* Premium Indigo */
    --accent-secondary: #ec4899; /* Pink */
    --accent-tertiary: #0ea5e9; /* Sky Blue */
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font-main: 'Outfit', sans-serif;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Gradients & Effects */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.05), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.05), transparent 25%);
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-tertiary);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
    100% { transform: translate(-20px, 80px) scale(0.9); }
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.brand {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand i {
    color: var(--accent-primary);
}

.nav-item {
    padding: 14px 20px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    height: 80px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 5;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: var(--bg-main);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #0284c7);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.grid {
    display: grid;
    gap: 24px;
}

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

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.purple { color: #6366f1; background: rgba(99, 102, 241, 0.1); }
.stat-icon.pink { color: #ec4899; background: rgba(236, 72, 153, 0.1); }
.stat-icon.blue { color: #0ea5e9; background: rgba(14, 165, 233, 0.1); }
.stat-icon.green { color: #10b981; background: rgba(16, 185, 129, 0.1); }

.stat-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    overflow: hidden;
    margin-top: 30px;
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px 24px;
    text-align: left;
}

th {
    background: var(--bg-main);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

td {
    border-bottom: 1px solid var(--border-glass);
    font-size: 14px;
    color: var(--text-primary);
}

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

tr:hover td {
    background: rgba(248, 250, 252, 0.8);
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge.new, .badge.document { background: rgba(14, 165, 233, 0.1); color: #0284c7; }
.badge.contacted, .badge.processing { background: rgba(236, 72, 153, 0.1); color: #be185d; }
.badge.interested, .badge.pending { background: rgba(99, 102, 241, 0.1); color: #4338ca; }
.badge.converted, .badge.approved, .badge.paid { background: rgba(16, 185, 129, 0.1); color: #047857; }
.badge.rejected { background: rgba(239, 68, 68, 0.1); color: #b91c1c; }

/* Modals & Forms */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 550px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-glass);
    transform: translateY(20px);
    animation: slideUp 0.3s forwards;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    flex-shrink: 0;
}

.modal-body-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 12px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}
.close-btn:hover { color: var(--danger); }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    background: var(--bg-main);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    font-family: var(--font-main);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--accent-primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Login Page specific adjustments */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}
.login-header p {
    margin-top: 8px;
    margin-bottom: 20px;
}
.error-message {
    color: var(--danger);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.login-credentials-info {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-main);
    border-radius: 12px;
    border: 1px dashed var(--border-glass);
}
.login-credentials-info ul {
    list-style: none;
    margin-top: 10px;
}
.login-credentials-info li {
    margin-bottom: 6px;
    font-size: 13px;
}
.login-credentials-info span {
    color: var(--accent-primary);
    font-weight: 600;
}

.restricted-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    text-align: center;
    color: var(--text-secondary);
}
.restricted-view i {
    font-size: 64px;
    margin-bottom: 20px;
    color: var(--danger);
    opacity: 0.2;
}

/* ==========================================================================
   Responsive Design & Media Queries
   ========================================================================== */

/* Utility for mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

/* Tablet & Smaller Desktop Screens (max-width: 1024px) */
@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-area {
        padding: 30px 20px;
    }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    /* Sidebar Off-Canvas */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(2px);
        z-index: 5;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.open {
        display: block;
        opacity: 1;
    }

    /* Adjust Layout */
    .header {
        padding: 0 20px;
        justify-content: flex-start;
        gap: 20px;
    }
    
    .header .user-profile {
        margin-left: auto;
    }
    
    .page-title {
        font-size: 24px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .page-header div {
        width: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .page-header button {
        width: 100%;
        justify-content: center;
    }

    /* Grids */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    /* Table Responsive Scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 800px;
    }
    
    /* Stats Cards */
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .stat-info p {
        font-size: 24px;
    }
    
    /* Forms & Modals */
    .modal-content {
        max-width: 95%;
        max-height: 90vh;
        padding: 20px;
    }
    .modal-body-scroll {
        padding-right: 6px;
    }
}

/* Very Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .content-area {
        padding: 20px 15px;
    }
    
    .card {
        padding: 16px;
    }
}
