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

:root {
    /* Premium Light Theme */
    --clr-bg-app: #f8f9fa; /* Soft slate/gray for background */
    --clr-bg-sidebar: #ffffff;
    --clr-bg-panel: #ffffff;
    --clr-bg-column: rgba(241, 245, 249, 0.6);
    --clr-bg-card: #ffffff;
    --clr-bg-hover: #f1f5f9;
    --clr-border: #e2e8f0;
    
    --clr-text-main: #0b1320;
    --clr-text-muted: #64748b;
    --clr-text-light: #94a3b8;
    
    /* Results Navy Brand Color */
    --clr-primary: #0b1320;
    --clr-primary-hover: #1e293b;
    --clr-primary-light: #f1f5f9;
    
    --clr-success: #10b981;
    --clr-success-bg: #d1fae5;
    --clr-warning: #f59e0b;
    --clr-warning-bg: #fef3c7;
    --clr-danger: #ef4444;
    --clr-danger-bg: #fee2e2;
    --clr-info: #3b82f6;
    --clr-info-bg: #dbeafe;

    --shadow-sm: 0 1px 2px 0 rgba(148, 163, 184, 0.15);
    --shadow-md: 0 4px 12px -2px rgba(148, 163, 184, 0.15), 0 2px 6px -2px rgba(148, 163, 184, 0.08);
    --shadow-lg: 0 10px 25px -3px rgba(148, 163, 184, 0.2), 0 4px 10px -4px rgba(148, 163, 184, 0.1);
    --shadow-hover: 0 12px 24px -6px rgba(79, 70, 229, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Theme extracted from User Screenshot */
    --clr-bg-app: #1c1d26; /* Main working area */
    --clr-bg-sidebar: #13141c; /* Sidebar and Topbar */
    --clr-bg-panel: #13141c; 
    --clr-bg-column: rgba(36, 37, 48, 0.4); 
    --clr-bg-card: #252631; /* Cards and Modules */
    --clr-bg-hover: #2e303d; /* Hover/Active tabs */
    --clr-border: #2e303f; /* Strokes and borders */
    
    --clr-text-main: #f8f8f8;
    --clr-text-muted: #8e909e;
    --clr-text-light: #6a6b77;
    
    /* Vibrant Muted Blue / Primary */
    --clr-primary: #3b68ff;
    --clr-primary-hover: #507aff;
    --clr-primary-light: rgba(59, 104, 255, 0.15);
    
    --clr-success: #22c55e;
    --clr-success-bg: rgba(34, 197, 94, 0.15);
    --clr-warning: #eab308;
    --clr-warning-bg: rgba(234, 179, 8, 0.15);
    --clr-danger: #ef4444;
    --clr-danger-bg: rgba(239, 68, 68, 0.15);
    --clr-info: #3b82f6;
    --clr-info-bg: rgba(59, 130, 246, 0.15);

    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 14px -2px rgba(0, 0, 0, 0.5), 0 3px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 15px 35px -5px rgba(0, 0, 0, 0.6), 0 8px 12px -6px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 24px -6px rgba(59, 104, 255, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--clr-bg-app);
    color: var(--clr-text-main);
    overflow: hidden; 
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

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

.animate-entrance {
    animation: fadeInSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--clr-bg-sidebar);
    border-right: 1px solid var(--clr-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: all var(--transition-normal);
}

.sidebar-header {
    height: 72px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--clr-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    letter-spacing: -0.5px;
    color: var(--clr-text-main);
}

.logo i {
    color: var(--clr-text-main);
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--clr-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.theme-toggle:hover {
    background: var(--clr-bg-hover);
    color: var(--clr-text-main);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--clr-text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 0;
    width: 4px;
    background-color: var(--clr-primary);
    border-radius: 0 4px 4px 0;
    transition: all var(--transition-fast);
}

.nav-item i {
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    background-color: var(--clr-bg-hover);
    color: var(--clr-text-main);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    background-color: var(--clr-primary-light);
    color: var(--clr-primary);
}

.nav-item.active::before {
    display: none;
}

.badge {
    margin-left: auto;
    background-color: var(--clr-danger);
    color: white;
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--clr-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
    cursor: pointer;
}

.user-profile:hover {
    background-color: var(--clr-bg-hover);
}

.avatar {
    width: 40px;
    height: 40px;
    background: #0b1320;
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: none;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--clr-text-muted);
    font-weight: 500;
}

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

.topbar {
    height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--clr-bg-panel);
    border-bottom: 1px solid var(--clr-border);
    z-index: 5;
    transition: all var(--transition-normal);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--clr-bg-app);
    padding: 10px 18px;
    border-radius: 8px;
    width: 360px;
    border: 1px solid var(--clr-border);
    transition: all var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px var(--clr-primary-light);
    background-color: var(--clr-bg-panel);
}

.search-bar i {
    color: var(--clr-text-light);
    font-size: 1.1rem;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--clr-text-main);
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: var(--clr-bg-panel);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--clr-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background-color var(--transition-fast);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--clr-bg-hover);
}

.search-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--clr-text-main);
}

.search-result-subtitle {
    font-size: 0.75rem;
    color: var(--clr-text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    font-family: inherit;
}

.btn-primary {
    background: var(--clr-primary);
    color: white;
    box-shadow: 0 4px 12px var(--clr-primary-light);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--clr-border);
    color: var(--clr-text-main);
}
.btn-outline:hover {
    background-color: var(--clr-bg-hover);
    border-color: var(--clr-text-muted);
}

.notifications {
    background: var(--clr-bg-app);
    border: 1px solid var(--clr-border);
    color: var(--clr-text-main);
    font-size: 1.25rem;
    cursor: pointer;
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.notifications:hover {
    border-color: var(--clr-primary);
    color: var(--clr-primary);
}

.indicator {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 10px;
    height: 10px;
    background-color: var(--clr-danger);
    border-radius: 50%;
    border: 2px solid var(--clr-bg-panel);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.view-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 32px 40px;
}

/* Modals & Side Panels */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 9, 20, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.side-panel {
    width: 650px;
    max-width: 100%;
    background: var(--clr-bg-panel);
    height: 100%;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .side-panel {
    transform: translateX(0);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--clr-text-muted);
}

.form-control {
    background-color: var(--clr-bg-app);
    border: 1px solid var(--clr-border);
    color: var(--clr-text-main);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px var(--clr-primary-light);
    background-color: var(--clr-bg-panel);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256' fill='%2364748b'%3E%3Cpath d='M213.66 101.66l-80 80a8 8 0 01-11.32 0l-80-80A8 8 0 0153.66 90.34L128 164.69l74.34-74.35a8 8 0 0111.32 11.32z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Utils */
.d-flex { display: flex; }
.custom-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { 
    background-color: var(--clr-border); 
    border-radius: var(--radius-full); 
    border: 2px solid transparent;
    background-clip: padding-box;
}
.custom-scroll::-webkit-scrollbar-thumb:hover { background-color: var(--clr-text-muted); }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 64px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--clr-border);
        z-index: 50;
        background-color: var(--clr-bg-sidebar);
    }
    
    .sidebar-header, .sidebar-footer {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        padding: 0;
        width: 100%;
        justify-content: space-around;
        align-items: center;
    }
    
    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 8px 4px;
        justify-content: center;
        flex: 1;
        border-radius: 0;
    }
    
    .nav-item i {
        font-size: 1.4rem;
    }
    
    .nav-item::before {
        display: none;
    }
    
    .nav-item span:not(.badge) {
        font-size: 0.65rem;
        display: block;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .nav-item.active {
        background-color: transparent;
        color: var(--clr-primary);
        border-top: 2px solid var(--clr-primary);
    }
    
    .badge {
        position: absolute;
        top: 4px;
        right: 50%;
        transform: translateX(12px);
        padding: 2px 6px;
        font-size: 0.6rem;
    }
    
    .main-content {
        padding-bottom: 64px; /* Space for bottom nav */
        height: 100vh;
    }
    
    .topbar {
        padding: 0 16px;
        height: 64px;
    }
    
    .search-bar {
        display: none; /* Hide search bar on mobile for simplicity, or make it collapsible */
    }
    
    #btn-new-lead {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    #btn-new-lead span {
        display: none; /* Only show icon + text conditionally */
    }
    
    .view-container {
        padding: 16px;
    }
    
    .side-panel {
        width: 100vw;
        border-radius: 0;
    }
    
    /* Login Page Mobile tweaks */
    #auth-root > div {
        flex-direction: column;
    }
    #auth-root .left-panel {
        display: none;
    }
}
