:root {
    --primary: #8b5cf6; /* Vibrant purple for buttons */
    --primary-dark: #2E1658; /* Theme base color */
    --primary-light: #c4b5fd;
    --bg-dark: #1e1b4b; /* Deep Indigo */
    --bg-darker: #0f172a; /* Near black */
    --text-white: #f5f3ff;
    --text-gray: #ddd6fe;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(46, 22, 88, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    color: var(--text-white);
    min-height: 100vh;
}

/* Sidebar */
aside {
    width: var(--sidebar-width);
    background: rgba(30, 27, 75, 0.8);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 2rem 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.logo {
    padding: 0 2rem;
    margin-bottom: 3rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

nav ul {
    list-style: none;
}

nav ul.nav-list {
    flex: 1;
}

nav ul li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    color: var(--text-gray);
    text-decoration: none;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

nav ul li a:hover, nav ul li a.active {
    background: var(--glass-bg);
    color: var(--primary-light);
    border-left-color: var(--primary);
}

/* Main Content */
main {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-width: 0;
}

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

.title-section h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.title-section p {
    color: var(--text-gray);
    opacity: 0.7;
}

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

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
    background: rgba(255, 255, 255, 0.08);
}

.stat-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-light);
}

/* Tables */
.table-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1rem;
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-gray);
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-gray);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-white);
    outline: none;
    transition: var(--transition);
    appearance: none; /* Reset for custom icons if needed */
}

select option {
    background-color: var(--bg-dark);
    color: var(--text-white);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-darker);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: scale(1.02);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-deal { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.status-contacted { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-not-contacted { background: rgba(156, 163, 175, 0.2); color: #d1d5db; }
.status-interested { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 2rem;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Login Page Specific */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--card-shadow);
}

/* Flash Messages */
.alert {
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

/* Mobile Header Overlay */
.mobile-header {
    display: none;
    background: var(--bg-dark);
    padding: 1rem 1.5rem;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1001;
    border-bottom: 1px solid var(--glass-border);
    height: 60px;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsiveness */
@media (max-width: 1024px) {
    aside {
        display: none;
        width: 100%;
        max-width: 300px;
        z-index: 2005;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    
    aside.active {
        display: flex;
        transform: none;
    }

    main {
        margin-left: 0 !important;
        padding: 1rem !important;
    }

    .mobile-header {
        display: flex;
    }

    aside .logo .menu-toggle {
        display: block !important;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header .actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .header .actions .btn {
        flex: 1;
        justify-content: center;
    }

    .filters form {
        flex-direction: column;
        align-items: stretch !important;
    }

    .filters form .form-group {
        width: 100%;
        margin-bottom: 1rem;
    }

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

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

    .login-card {
        margin: 1rem;
        padding: 2rem;
        max-width: calc(100% - 2rem);
    }

    .modal {
        padding: 1.5rem;
        border-radius: 1rem;
    }
    
    .modal .stats-grid {
        grid-template-columns: 1fr !important;
    }
}
