﻿/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* CSS Variables - Light Theme with Brand Colors */
:root {
    /* Core Layout Variables */
    --sidebar-width: 260px;
    --navbar-height: 64px;
    /* Brand Color Palette - Professional Variants */
    --brand-primary: #2563eb; /* Main brand blue - darker than original */
    --brand-primary-hover: #1d4ed8; /* Hover state */
    --brand-primary-light: #3b82f6; /* Lighter variant for accents */
    --brand-secondary: #1e40af; /* Deep blue for secondary elements */
    --brand-accent: #0ea5e9; /* Sky blue for highlights */
    /* Brand Grays with Blue Tints */
    --brand-gray-50: #f8fafc; /* Very light with blue tint */
    --brand-gray-100: #f1f5f9; /* Light background with blue tint */
    --brand-gray-200: #e2e8f0; /* Border color with blue tint */
    --brand-gray-300: #cbd5e1; /* Subtle blue-gray */
    --brand-gray-400: #94a3b8; /* Medium blue-gray */
    --brand-gray-500: #64748b; /* Text secondary with blue tint */
    --brand-gray-600: #475569; /* Text primary dark mode */
    --brand-gray-700: #334155; /* Dark backgrounds */
    --brand-gray-800: #1e293b; /* Darker backgrounds */
    --brand-gray-900: #0f172a; /* Darkest backgrounds */
    /* System Colors - Updated with Brand Colors */
    --primary-color: var(--brand-primary);
    --primary-hover: var(--brand-primary-hover);
    --text-primary: #111827;
    --text-secondary: var(--brand-gray-500);
    --border-color: var(--brand-gray-200);
    --bg-white: #ffffff;
    --bg-gray-50: var(--brand-gray-50);
    --bg-gray-100: var(--brand-gray-100);
    --bg-body: var(--brand-gray-50);
    /* Enhanced Shadows with Brand Tint */
    --shadow-sm: 0 1px 2px 0 rgba(37, 99, 235, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
    /* Brand Gradients */
    --brand-gradient: linear-gradient(135deg, var(--brand-primary-light) 0%, var(--brand-primary) 50%, var(--brand-secondary) 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
}

/* Dark Theme Variables with Brand Colors */
[data-theme="dark"] {
    --text-primary: var(--brand-gray-50);
    --text-secondary: var(--brand-gray-400);
    --border-color: var(--brand-gray-700);
    --bg-white: var(--brand-gray-800);
    --bg-gray-50: var(--brand-gray-900);
    --bg-gray-100: var(--brand-gray-700);
    --bg-body: var(--brand-gray-900);
    /* Adjusted primary colors for dark mode */
    --primary-color: var(--brand-primary-light);
    --primary-hover: var(--brand-accent);
    /* Enhanced dark mode shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    /* Dark mode gradients */
    --brand-gradient: linear-gradient(135deg, var(--brand-primary-light) 0%, var(--brand-accent) 50%, var(--brand-primary) 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(14, 165, 233, 0.1) 100%);
}

/* Top Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
    max-width: none;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 16px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

    .mobile-menu-btn:hover {
        background: var(--bg-gray-50);
    }

.hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    margin: 2px 0;
    transition: 0.3s;
    border-radius: 1px;
}

/* Brand/Logo */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .navbar-brand h1 {
        font-size: 20px;
        font-weight: 600;
        color: var(--text-primary);
        background: var(--brand-gradient);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

.navbar-logo {
    width: 32px;
    height: 32px;
    background: var(--brand-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* Navbar Right Side */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    position: relative;
    overflow: hidden;
}

    .theme-toggle::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: var(--brand-gradient-subtle);
        transition: left 0.3s ease;
    }

    .theme-toggle:hover {
        background: var(--bg-gray-50);
        color: var(--brand-primary);
        border-color: var(--brand-primary);
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

        .theme-toggle:hover::before {
            left: 100%;
        }

    .theme-toggle .theme-icon {
        font-size: 16px;
        transition: transform 0.3s ease;
        position: relative;
        z-index: 1;
    }

        .theme-toggle .theme-icon.rotate {
            transform: rotate(180deg);
        }

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-gray-50);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.connection-status.connected .status-dot {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.connection-status.connecting .status-dot {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

@@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

    .user-menu-btn:hover {
        background: var(--bg-gray-50);
        border-color: var(--brand-primary);
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.user-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.user-menu-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
    z-index: 1001;
    overflow: hidden;
}

    .user-dropdown.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
}

    .dropdown-item:hover {
        background: var(--brand-gradient-subtle);
        color: var(--brand-primary);
    }

.dropdown-divider {
    margin: 8px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    z-index: 900;
    transform: translateX(0);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

/* Navigation */
.nav-list {
    list-style: none;
}

.nav-item {
    margin: 0 12px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

    .nav-link::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: var(--brand-gradient-subtle);
        transition: left 0.3s ease;
    }

    .nav-link:hover {
        background: var(--bg-gray-50);
        color: var(--brand-primary);
        transform: translateX(4px);
    }

        .nav-link:hover::before {
            left: 100%;
        }

    .nav-link.active {
        background: var(--brand-gradient-subtle);
        color: var(--brand-primary);
        border-left: 3px solid var(--brand-primary);
        margin-left: 9px;
        padding-left: 13px;
        box-shadow: var(--shadow-sm);
    }

.nav-icon {
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.nav-text {
    flex: 1;
    position: relative;
    z-index: 1;
}

.submenu-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    position: relative;
    z-index: 1;
}

.nav-link.expanded .submenu-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 4px;
}

    .nav-submenu.show {
        max-height: 200px;
    }

.nav-sublink {
    display: block;
    padding: 8px 16px 8px 48px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
    margin: 2px 0;
    transition: all 0.2s;
}

    .nav-sublink:hover {
        background: var(--bg-gray-50);
        color: var(--brand-primary);
        transform: translateX(4px);
    }

    .nav-sublink.active {
        background: var(--brand-gradient-subtle);
        color: var(--brand-primary);
    }

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--brand-gradient-subtle);
}

.api-status-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.api-status-url {
    font-size: 12px;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
    word-break: break-all;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--bg-body);
    transition: margin-left 0.3s ease;
}

/* Page Header */
.page-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Content Area */
.content-area {
    padding: 32px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

    .welcome-message h2 {
        font-size: 24px;
        color: var(--text-primary);
        margin-bottom: 8px;
    }

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 800;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

    .mobile-overlay.show {
        opacity: 1;
        visibility: visible;
    }

/* Dark Theme Adjustments */
[data-theme="dark"] .nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--brand-primary-light);
    border-left-color: var(--brand-primary-light);
}

[data-theme="dark"] .nav-sublink.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--brand-primary-light);
}

[data-theme="dark"] .sidebar-footer {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .api-status-label {
    color: var(--brand-primary-light);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.show {
            transform: translateX(0);
        }

    .mobile-menu-btn {
        display: flex;
    }

    .navbar-brand {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .navbar-content {
        padding: 0 16px;
    }

    .navbar-right {
        gap: 12px;
    }

    .user-name {
        display: none;
    }

    .connection-status .status-text {
        display: none;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

        .theme-toggle .theme-icon {
            font-size: 14px;
        }

    .page-header {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .content-area {
        padding: 20px;
    }

    .page-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .navbar-content {
        padding: 0 12px;
    }

    .content-area {
        padding: 16px;
    }
}
