/**
 * QuantaxLabs Theme - Professional Dark Design System
 * Clean, modern, and responsive UI
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Dark Theme Colors */
    --bg-primary: #0f0f12;
    --bg-secondary: #16161a;
    --bg-tertiary: #1c1c21;
    --bg-elevated: #222228;
    --bg-hover: #2a2a32;

    /* Surface Colors */
    --surface-1: #1e1e24;
    --surface-2: #252530;
    --surface-3: #2d2d38;

    /* Border Colors */
    --border-primary: #2e2e38;
    --border-secondary: #3a3a48;
    --border-active: #4a4a58;

    /* Text Colors */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #71717a;
    --text-dim: #52525b;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-hover: #7c7ff5;
    --accent-primary-hover: #818cf8;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-success-light: #34d399;
    --accent-warning: #f59e0b;
    --accent-warning-light: #fbbf24;
    --accent-danger: #ef4444;
    --accent-danger-light: #f87171;
    --accent-info: #3b82f6;
    --accent-info-light: #60a5fa;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;

    /* Font */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

/* Remove decorative elements */
.decorative-circle,
.q-background,
.deco-circle,
.deco-1,
.deco-2,
.deco-3 {
    display: none !important;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.5em;
    color: var(--text-primary);
}

h1 { font-size: 1.875rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }
h6 { font-size: 0.875rem; font-weight: 600; }

p { margin: 0 0 1em; color: var(--text-secondary); }

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover { color: var(--accent-primary-hover); }

/* ============================================
   Layout
   ============================================ */
.q-layout {
    display: flex;
    min-height: 100vh;
}

.q-body {
    background: var(--bg-primary);
}

.q-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
    margin-left: 260px;
}

@media (max-width: 768px) {
    .q-main {
        margin-left: 0;
    }
}

.q-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ============================================
   Sidebar
   ============================================ */
.q-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform var(--transition-normal);
}

.q-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.q-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.q-sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
}

.q-sidebar-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.q-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.q-sidebar-section {
    padding: 12px 20px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.q-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 2px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.q-sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.q-sidebar-item.active {
    background: var(--accent-primary);
    color: white;
}

.q-sidebar-item-icon {
    width: 20px;
    font-size: 1.1rem;
    text-align: center;
    opacity: 0.8;
}

.q-sidebar-item.active .q-sidebar-item-icon {
    opacity: 1;
}

.q-sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.q-sidebar-item-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--accent-danger);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

.q-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-primary);
}

.q-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.q-sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.q-sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.q-sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.q-sidebar-user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.q-sidebar-logout {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.q-sidebar-logout:hover {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    color: white;
}

.q-sidebar-logo-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

/* ============================================
   Header
   ============================================ */
.q-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.q-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.q-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.q-header-search {
    position: relative;
}

.q-header-search-input {
    width: 280px;
    padding: 8px 12px 8px 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.q-header-search-input::placeholder {
    color: var(--text-muted);
}

.q-header-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-1);
}

.q-header-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.q-header-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.q-header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.q-header-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.q-header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.q-header-search svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.q-header-search input {
    width: 240px;
    padding: 8px 12px 8px 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.q-header-search input::placeholder {
    color: var(--text-muted);
}

.q-header-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-1);
}

.q-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.q-header-action-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.q-header-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.q-header-action-primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.q-header-action-primary:hover {
    background: var(--accent-primary-hover);
    color: white;
}

.q-header-notifications {
    position: relative;
}

.q-header-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--accent-danger);
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.q-header-dropdown {
    position: relative;
}

.q-header-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.q-header-user-btn:hover {
    background: var(--bg-hover);
}

.q-header-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
}

.q-header-user-name {
    font-weight: 500;
    font-size: 0.875rem;
}

/* Header Dropdown Menus */
.q-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface-1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 280px;
    overflow: hidden;
}

.q-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.q-dropdown-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.q-dropdown-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-full);
}

.q-dropdown-body {
    max-height: 320px;
    overflow-y: auto;
}

.q-dropdown-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-primary);
    text-align: center;
}

.q-dropdown-footer a {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-primary);
}

.q-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.q-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.q-dropdown-item svg {
    flex-shrink: 0;
}

/* Notification items */
.q-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-primary);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.q-notification-item:last-child {
    border-bottom: none;
}

.q-notification-item:hover {
    background: var(--bg-hover);
}

.q-notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.q-notification-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.q-notification-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.q-notification-icon.purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

.q-notification-content {
    flex: 1;
    min-width: 0;
}

.q-notification-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 2px;
}

.q-notification-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.q-notification-time {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin: 4px 0 0;
}

/* User Dropdown */
.q-dropdown-user-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
}

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

.q-dropdown-user-info {
    flex: 1;
    min-width: 0;
}

.q-dropdown-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
}

.q-dropdown-user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.q-dropdown-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: var(--accent-danger-light);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.q-dropdown-logout:hover {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    color: white;
}

/* Theme Toggle Icons */
.theme-icon-light {
    display: none;
}

.light .theme-icon-dark {
    display: none;
}

.light .theme-icon-light {
    display: block;
}

/* Responsive Header */
@media (max-width: 768px) {
    .q-header-menu-btn {
        display: flex;
    }

    .q-header-search {
        display: none;
    }

    .q-header-user-name {
        display: none;
    }

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

@media (max-width: 480px) {
    .q-header-actions {
        gap: 4px;
    }

    .q-header-action-btn {
        width: 32px;
        height: 32px;
    }
}

/* ============================================
   Cards
   ============================================ */
.q-card {
    background: var(--surface-1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 20px;
    transition: all var(--transition-fast);
}

.q-card:hover {
    border-color: var(--border-secondary);
}

.q-card-header {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.q-card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

/* ============================================
   Buttons
   ============================================ */
.q-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

.q-btn-primary {
    background: var(--accent-primary);
    color: white;
}

.q-btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
}

.q-btn-secondary {
    background: var(--surface-2);
    border-color: var(--border-secondary);
    color: var(--text-primary);
}

.q-btn-secondary:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--border-active);
}

.q-btn-danger {
    background: var(--accent-danger);
    color: white;
}

.q-btn-danger:hover:not(:disabled) {
    background: var(--accent-danger-light);
}

.q-btn-success {
    background: var(--accent-success);
    color: white;
}

.q-btn-success:hover:not(:disabled) {
    background: var(--accent-success-light);
}

.q-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.q-btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.q-btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.q-btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.q-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

/* ============================================
   Form Elements
   ============================================ */
.q-input,
.q-select,
.q-textarea {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.q-input:focus,
.q-select:focus,
.q-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-1);
}

.q-input::placeholder,
.q-textarea::placeholder {
    color: var(--text-muted);
}

.q-textarea {
    min-height: 100px;
    resize: vertical;
}

.q-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.q-label-required::after {
    content: ' *';
    color: var(--accent-danger);
}

.q-select {
    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 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Checkbox & Toggle */
.q-checkbox,
.q-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.q-checkbox input,
.q-toggle input {
    display: none;
}

.q-checkbox-box {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.q-checkbox input:checked + .q-checkbox-box {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.q-checkbox input:checked + .q-checkbox-box::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.q-toggle-track {
    width: 44px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.q-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all var(--transition-fast);
}

.q-toggle input:checked + .q-toggle-track {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.q-toggle input:checked + .q-toggle-track .q-toggle-thumb {
    left: calc(100% - 20px);
    background: white;
}

/* ============================================
   Tables
   ============================================ */
.q-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
}

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

.q-table th,
.q-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.q-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

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

.q-table tr:hover td {
    background: var(--bg-hover);
}

/* ============================================
   Badges
   ============================================ */
.q-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--surface-2);
    color: var(--text-secondary);
}

.q-badge-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-success-light); }
.q-badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning-light); }
.q-badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger-light); }
.q-badge-info { background: rgba(59, 130, 246, 0.15); color: var(--accent-info-light); }
.q-badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--accent-primary-hover); }

/* ============================================
   Alerts
   ============================================ */
.q-alert {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.875rem;
    border: 1px solid;
}

.q-alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-success-light);
}

.q-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--accent-warning-light);
}

.q-alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-danger-light);
}

.q-alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--accent-info-light);
}

/* ============================================
   Avatar
   ============================================ */
.q-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    flex-shrink: 0;
}

.q-avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.q-avatar-md { width: 40px; height: 40px; font-size: 0.875rem; }
.q-avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.q-avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; }

.q-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.q-avatar-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.q-avatar-status-online { background: var(--accent-success); }
.q-avatar-status-away { background: var(--accent-warning); }
.q-avatar-status-busy { background: var(--accent-danger); }
.q-avatar-status-offline { background: var(--text-muted); }

/* ============================================
   Modal
   ============================================ */
.q-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.q-modal {
    background: var(--surface-1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.q-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.q-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.q-modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.q-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.q-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.q-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================
   Stats Cards
   ============================================ */
.q-stat-card {
    background: var(--surface-1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 20px;
    transition: all var(--transition-fast);
}

.q-stat-card:hover {
    border-color: var(--border-secondary);
}

.q-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 16px;
}

.q-stat-icon-primary { background: rgba(99, 102, 241, 0.15); color: var(--accent-primary); }
.q-stat-icon-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.q-stat-icon-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.q-stat-icon-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }
.q-stat-icon-info { background: rgba(59, 130, 246, 0.15); color: var(--accent-info); }

.q-stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.q-stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.q-stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 12px;
}

.q-stat-change-up { background: rgba(16, 185, 129, 0.15); color: var(--accent-success-light); }
.q-stat-change-down { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger-light); }

/* ============================================
   Tabs
   ============================================ */
.q-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-primary);
}

.q-tab {
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.875rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
    transition: color var(--transition-fast);
}

.q-tab:hover { color: var(--text-primary); }

.q-tab.active {
    color: var(--accent-primary);
}

.q-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
}

/* ============================================
   Dropdown
   ============================================ */
.q-dropdown {
    position: relative;
    display: inline-block;
}

.q-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    background: var(--surface-1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    z-index: 1000;
}

.q-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.q-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.q-dropdown-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 4px 0;
}

/* ============================================
   Pagination
   ============================================ */
.q-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.q-pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.q-pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.q-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   Progress Bar
   ============================================ */
.q-progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.q-progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.q-progress-primary .q-progress-bar { background: var(--accent-primary); }
.q-progress-success .q-progress-bar { background: var(--accent-success); }
.q-progress-warning .q-progress-bar { background: var(--accent-warning); }
.q-progress-danger .q-progress-bar { background: var(--accent-danger); }

/* ============================================
   Empty State
   ============================================ */
.q-empty {
    text-align: center;
    padding: 48px 24px;
}

.q-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.q-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.q-empty-text {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================
   Loading
   ============================================ */
.q-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.q-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-secondary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.q-skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Grid
   ============================================ */
.q-grid {
    display: grid;
    gap: 20px;
}

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

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-success); }
.text-danger { color: var(--accent-danger); }
.text-warning { color: var(--accent-warning); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .q-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .q-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .q-grid-4,
    .q-grid-3,
    .q-grid-2 { grid-template-columns: 1fr; }

    .q-content { padding: 16px; }

    .q-sidebar {
        transform: translateX(-100%);
    }

    .q-sidebar.open {
        transform: translateX(0);
    }

    .q-header-search-input {
        width: 200px;
    }

    .hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
    .q-header-search { display: none; }
    .q-content { padding: 12px; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-active);
}

/* Animation utilities */
.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slideIn {
    animation: slideIn 0.3s ease;
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
