/* ==========================================================================
   COLORCRAFT PRO - Advanced Dark Theme
   ========================================================================== */
   :root {
    /* Advanced Color System - Dark Base */
    --color-space-50: #0a0a0f;
    --color-space-100: #11111d;
    --color-space-200: #1a1a2a;
    --color-space-300: #232338;
    --color-space-400: #2d2d46;
    --color-space-500: #383854;
    --color-space-600: #444463;
    --color-space-700: #515173;
    --color-space-800: #5f5f83;
    --color-space-900: #6e6e94;
    
    /* Primary Colors - Cyber/Vibrant */
    --primary-50: #0d0d1a;
    --primary-100: #1a1a33;
    --primary-200: #2d2d66;
    --primary-300: #404099;
    --primary-400: #5c5cbf;
    --primary-500: #7a7ae6;
    --primary-600: #9999ff;
    --primary-700: #b8b8ff;
    --primary-800: #d6d6ff;
    --primary-900: #f0f0ff;
    
    /* Accent Colors */
    --accent-teal: #00f5d4;
    --accent-purple: #9d4edd;
    --accent-pink: #ff4d8d;
    --accent-amber: #ffb347;
    --accent-cyan: #00bbf9;
    
    /* Semantic Colors - Glowing */
    --success: #00ff9d;
    --success-glow: rgba(0, 255, 157, 0.15);
    --warning: #ffd166;
    --warning-glow: rgba(255, 209, 102, 0.15);
    --error: #ff6b6b;
    --error-glow: rgba(255, 107, 107, 0.15);
    --info: #4cc9f0;
    --info-glow: rgba(76, 201, 240, 0.15);
    
    /* UI Colors - Deep Space */
    --bg-primary: #0a0a0f;
    --bg-secondary: #11111d;
    --bg-tertiary: #1a1a2a;
    --bg-elevated: #232338;
    --bg-overlay: rgba(10, 10, 15, 0.95);
    
    --bg-sidebar: #11111d;
    --bg-canvas: #0a0a0f;
    --bg-toolbar: #1a1a2a;
    
    --text-primary: #ffffff;
    --text-secondary: #b3b3cc;
    --text-tertiary: #8a8aa3;
    --text-inverse: #0a0a0f;
    --text-accent: var(--primary-600);
    
    --border-light: #2d2d46;
    --border: #383854;
    --border-dark: #444463;
    --border-glow: rgba(153, 153, 255, 0.3);
    
    /* Advanced Shadows - Glow Effects */
    --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    
    --glow-sm: 0 0 10px rgba(153, 153, 255, 0.1);
    --glow: 0 0 20px rgba(153, 153, 255, 0.15);
    --glow-md: 0 0 30px rgba(153, 153, 255, 0.2);
    --glow-lg: 0 0 40px rgba(153, 153, 255, 0.25);
    --glow-xl: 0 0 60px rgba(153, 153, 255, 0.3);
    
    /* Advanced Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-500) 0%, var(--accent-teal) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    --gradient-space: linear-gradient(135deg, var(--color-space-100) 0%, var(--color-space-300) 100%);
    --gradient-overlay: linear-gradient(180deg, rgba(10, 10, 15, 0) 0%, var(--bg-primary) 100%);
    
    /* Typography - Modern Tech */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    --font-display: 'Space Grotesk', var(--font-sans);
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    
    /* Spacing - 8px Grid */
    --space-0: 0px;
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;
    --space-8: 64px;
    --space-10: 80px;
    --space-12: 96px;
    
    /* Border Radius - Soft Modern */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;
    --radius-pill: 999px;
    
    /* Transitions - Smooth & Deliberate */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Layout */
    --sidebar-width: 280px;
    
    /* Sidebar specific spacing */
    --sidebar-gap: var(--space-2);
    --sidebar-padding: var(--space-3);
    --header-height: 72px;
    --toolbar-height: 56px;
    --border-width: 2px;
    
    /* Z-index Layers */
    --z-below: -1;
    --z-base: 0;
    --z-elevated: 10;
    --z-overlay: 20;
    --z-modal: 30;
    --z-popover: 40;
    --z-tooltip: 50;
    --z-toast: 60;
    --z-max: 100;
    
    /* Blur Effects */
    --backdrop-blur: blur(20px);
    --backdrop-saturate: saturate(180%);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    height: 100%;
    scroll-behavior: smooth;
    background: var(--bg-primary);
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(153, 153, 255, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 85% 30%, rgba(0, 245, 212, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 50% 80%, rgba(157, 78, 221, 0.04) 0%, transparent 20%);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 47%, rgba(153, 153, 255, 0.02) 48%, rgba(153, 153, 255, 0.02) 52%, transparent 53%),
        linear-gradient(0deg, transparent 47%, rgba(153, 153, 255, 0.02) 48%, rgba(153, 153, 255, 0.02) 52%, transparent 53%);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: -1;
    opacity: 0.15;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--color-space-400);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-space-500);
}

::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

/* Selection */
::selection {
    background: var(--primary-500);
    color: var(--text-primary);
}

::-moz-selection {
    background: var(--primary-500);
    color: var(--text-primary);
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.app-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main"
        "sidebar main";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    gap: 1px;
    background: var(--border-light);
    position: relative;
    overflow: hidden;
}

.app-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 0%,
        rgba(153, 153, 255, 0.03) 50%,
        transparent 100%
    );
    pointer-events: none;
    z-index: -1;
}

/* Header */
.header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    background: rgba(17, 17, 29, 0.95);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-bottom: 1px solid var(--border-light);
    z-index: var(--z-overlay);
    position: relative;
    box-shadow: var(--shadow-md);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(153, 153, 255, 0.1) 0%,
        transparent 100%
    );
    pointer-events: none;
    z-index: -1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    position: relative;
}

.logo {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    position: relative;
}

.logo::after {
    content: 'PRO';
    position: absolute;
    top: -8px;
    right: -32px;
    font-size: var(--text-xs);
    font-weight: 700;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-glow);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow);
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: rgba(17, 17, 29, 0.95);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    height: calc(100vh - var(--header-height));
    position: relative;
    box-shadow: var(--shadow-lg);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--color-space-400);
    border-radius: var(--radius-full);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--border-glow) 50%,
        transparent 100%
    );
    pointer-events: none;
}

/* Main Content */
.main-content {
    grid-area: main;
    overflow-y: auto;
    padding: 0;
    background: var(--bg-canvas);
    height: calc(100vh - var(--header-height));
    position: relative;
    display: flex;
    flex-direction: column;
}

.main-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--gradient-overlay);
    pointer-events: none;
    z-index: var(--z-elevated);
}

/* ==========================================================================
   TAB NAVIGATION
   ========================================================================== */
.tab-navigation {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 90;
    margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-4);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 2px solid transparent;
    background: transparent;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    font-family: var(--font-sans);
    white-space: nowrap;
}

.tab-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.tab-button.active {
    background: var(--bg-elevated);
    border-color: transparent;
    border-bottom-color: var(--primary-500);
    color: var(--primary-500);
    box-shadow: none;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-500);
    border-radius: 2px 2px 0 0;
    z-index: 2;
}

.tab-icon {
    font-size: var(--text-lg);
}

.tab-label {
    font-size: var(--text-sm);
    font-weight: 600;
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: var(--space-6);
    animation: fadeIn 0.3s ease;
    padding: var(--space-4);
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Collapsible Sections */
.collapsible-section {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: rgba(26, 26, 42, 0.6);
    border-bottom: 1px solid transparent;
    transition: all var(--transition);
}

.collapsible-header:hover {
    background: rgba(26, 26, 42, 0.8);
}

.collapsible-header.expanded {
    border-bottom-color: var(--border);
}

.collapsible-toggle {
    transition: transform var(--transition);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.collapsible-toggle:hover {
    border-color: var(--primary-500);
}

.collapsible-toggle .collapse-icon {
    display: inline-block;
    transition: transform var(--transition);
    font-size: 0.8em;
}

.collapsible-content {
    padding: var(--space-4);
    background: var(--bg-tertiary);
    animation: slideDown 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

.collapsible-content.expanded {
    max-height: 800px;
    overflow: visible;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 800px;
    }
}

.collapsible-header.expanded .collapsible-toggle .collapse-icon {
    transform: rotate(180deg);
}

.collapsible-badge {
    display: inline-block;
    padding: 2px var(--space-2);
    background: var(--accent-purple);
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius);
    margin-left: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .tab-navigation {
        padding: var(--space-2);
        gap: var(--space-1);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) var(--space-3);
        padding-left: var(--space-2);
        padding-right: var(--space-2);
    }
    
    .tab-button {
        padding: var(--space-1) var(--space-3);
        font-size: var(--text-xs);
        min-width: fit-content;
    }
    
    .tab-label {
        display: none;
    }
    
    .tab-icon {
        font-size: var(--text-base);
        margin: 0;
    }
    
    .tab-button.active::after {
        bottom: -2px;
        height: 2px;
    }
}

/* ==========================================================================
   SIDEBAR COMPONENTS
   ========================================================================== */
.sidebar-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.sidebar-section:hover {
    box-shadow: var(--shadow), var(--glow-sm);
    border-color: var(--border-glow);
}

.sidebar-section-title {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(26, 26, 42, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-section-content {
    padding: var(--space-3);
}

/* Compact Color Picker */
.color-picker-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.color-picker-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.color-picker-small {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    background: transparent;
    transition: all var(--transition);
    padding: 0;
}

.color-picker-small:hover {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-sm), var(--glow-sm);
    transform: scale(1.05);
}

.color-picker-small::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-small::-webkit-color-swatch {
    border: none;
    border-radius: var(--radius);
}

.color-input-compact {
    flex: 1;
    padding: var(--space-1) var(--space-2);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    transition: all var(--transition);
    min-width: 0;
}

.color-input-compact:focus {
    outline: none;
    border-color: var(--primary-500);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px rgba(153, 153, 255, 0.1);
}

.color-input-compact::placeholder {
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

.color-preview-compact {
    width: 100%;
    height: 48px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.color-preview-compact:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow), var(--glow-sm);
    border-color: var(--primary-500);
}

.color-preview-compact::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity var(--transition);
}

.color-preview-compact:hover::after {
    opacity: 1;
    animation: shine 2s infinite;
}

.color-picker-actions {
    display: flex;
    gap: var(--space-1);
    justify-content: center;
}

.color-picker-actions .btn-icon {
    width: 28px;
    height: 28px;
    font-size: var(--text-xs);
    border-width: 1px;
}

.color-values-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.color-value-compact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
    min-width: 0;
}

.color-value-compact-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-500);
}

.color-value-label-small {
    color: var(--text-tertiary);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    flex-shrink: 0;
    margin-right: var(--space-1);
}

.color-value-small {
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition);
    font-size: var(--text-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: right;
}

.color-value-small:hover {
    color: var(--primary-500);
}

/* Color History Grid */
.color-history-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-1);
}

.history-color {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.history-color:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow), 0 0 15px currentColor;
    border-color: currentColor;
    z-index: var(--z-elevated);
}

.history-color::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity var(--transition);
}

.history-color:hover::after {
    opacity: 1;
    animation: shine 1.5s infinite;
}

/* Saved Palettes */
.saved-palettes {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.saved-palette {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
}

.saved-palette:hover {
    background: var(--bg-elevated);
    border-color: var(--primary-500);
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

.saved-palette::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition);
}

.saved-palette:hover::before {
    opacity: 1;
}

.palette-preview {
    display: flex;
    gap: 1px;
    flex: 1;
    height: 24px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.palette-preview-color {
    flex: 1;
    transition: all var(--transition);
}

.palette-preview:hover .palette-preview-color {
    transform: scaleY(1.15);
}

/* ==========================================================================
   QUICK ACTIONS
   ========================================================================== */
.quick-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow), var(--glow-sm);
}

.quick-actions::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 0%,
        rgba(153, 153, 255, 0.05) 50%,
        transparent 100%
    );
    pointer-events: none;
}

.action-btn {
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    min-height: 44px;
    flex: 1;
    min-width: 140px;
    justify-content: center;
}

/* Smaller action buttons in sidebar */
.sidebar .action-btn {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    min-height: 32px;
    border-width: 1px;
    border-radius: var(--radius);
    justify-content: center;
    min-width: 0;
    flex: none;
    width: 100%;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    transition: left var(--transition-slow);
}

.action-btn:hover {
    border-color: var(--primary-500);
    color: var(--primary-500);
    background: var(--bg-elevated);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn.primary {
    background: var(--gradient-primary);
    border-color: transparent;
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow), var(--glow-sm);
}

.action-btn.primary:hover {
    background: var(--gradient-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--glow);
    filter: brightness(1.1);
}

/* ==========================================================================
   PALETTE SECTION
   ========================================================================== */
.palette-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.palette-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    z-index: var(--z-elevated);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100px;
    height: 2px;
    background: var(--gradient-primary);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.section-title::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--primary-500);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--primary-500);
}

.section-actions {
    display: flex;
    gap: var(--space-1);
    align-items: center;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
    align-items: start;
}

.palette-category-header {
    grid-column: 1 / -1;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
}

.palette-category-header:first-child {
    margin-top: 0;
}

.palette-color-card {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.palette-color-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--glow);
    border-color: var(--border-glow);
    z-index: var(--z-elevated);
}

.palette-swatch {
    height: 100px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.palette-swatch::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.2) 100%
    );
}

.palette-swatch-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    background: rgba(0, 0, 0, 0.3);
    z-index: var(--z-elevated);
}

.palette-color-card:hover .palette-swatch-overlay {
    opacity: 1;
}

.palette-info {
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    background: var(--bg-tertiary);
    position: relative;
    min-height: 64px;
}

.palette-category-header {
    grid-column: 1 / -1;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.palette-category-header:first-child {
    margin-top: 0;
}

.palette-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        var(--border) 50%,
        transparent 100%
    );
}

.palette-hex {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.palette-actions {
    display: flex;
    gap: var(--space-1);
    margin-top: auto;
    justify-content: flex-end;
}

/* ==========================================================================
   HARMONY SECTION
   ========================================================================== */
.harmony-tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-tertiary);
    padding: var(--space-1);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    position: relative;
    overflow-x: auto;
    scrollbar-width: none;
}

.harmony-tabs::-webkit-scrollbar {
    display: none;
}

.harmony-tabs::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 0%,
        rgba(153, 153, 255, 0.05) 50%,
        transparent 100%
    );
    pointer-events: none;
}

.harmony-tab {
    padding: var(--space-1) var(--space-3);
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-weight: 500;
    position: relative;
    z-index: var(--z-base);
    flex-shrink: 0;
}

.harmony-tab:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.harmony-tab.active {
    background: var(--bg-primary);
    color: var(--primary-500);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}

.harmony-tab.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(153, 153, 255, 0.1) 0%,
        transparent 100%
    );
    border-radius: inherit;
    z-index: var(--z-below);
}

.harmony-colors {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.harmony-color {
    height: 60px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
}

.harmony-color:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md), var(--glow-sm);
    border-color: var(--primary-500);
    z-index: var(--z-elevated);
}

.harmony-color::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity var(--transition);
}

.harmony-color:hover::after {
    opacity: 1;
    animation: shine 1s infinite;
}

/* ==========================================================================
   WEBSITE PREVIEW
   ========================================================================== */
.website-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: var(--space-4);
    box-shadow: var(--shadow), var(--glow-sm);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.preview-header {
    background: var(--bg-secondary);
    padding: var(--space-3) var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.preview-logo {
    font-size: var(--text-lg);
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
}

.preview-nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.preview-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: color 0.2s;
}

.preview-nav-link:hover {
    color: var(--text-primary);
}

.preview-btn-primary {
    background: var(--preview-primary-500, var(--primary-500));
    color: white;
    border: none;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-btn-primary:hover {
    background: var(--preview-primary-600, var(--primary-600));
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.preview-btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--preview-primary-500, var(--primary-500));
}

.preview-hero {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    background: linear-gradient(135deg, var(--preview-primary-500, var(--primary-500)) 0%, var(--preview-primary-700, var(--primary-700)) 100%);
    color: white;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.preview-hero-title {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-bottom: var(--space-3);
    font-family: var(--font-display);
}

.preview-hero-text {
    font-size: var(--text-base);
    margin-bottom: var(--space-4);
    opacity: 0.95;
    max-width: 500px;
}

.preview-hero-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    justify-content: center;
}

.preview-hero-actions .preview-btn-primary {
    background: white;
    color: var(--preview-primary-500, var(--primary-500));
}

.preview-hero-actions .preview-btn-primary:hover {
    background: rgba(255, 255, 255, 0.95);
}

.preview-hero-actions .preview-btn-secondary {
    background: transparent;
    color: white;
    border-color: white;
}

.preview-hero-actions .preview-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.preview-content {
    padding: var(--space-6) var(--space-4);
    background: var(--bg-primary);
}

.preview-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
    max-width: 1000px;
    margin: 0 auto;
}

.preview-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    transition: all 0.2s;
}

.preview-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--card-hover-border, var(--preview-primary-500, var(--primary-500)));
}

.preview-card-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
}

.preview-card-title {
    font-size: var(--text-base);
    font-weight: 700;
    margin-bottom: var(--space-1);
    color: var(--text-primary);
    font-family: var(--font-display);
}

.preview-card-text {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: var(--space-3);
}

.preview-card-link {
    color: var(--preview-primary-500, var(--primary-500));
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 600;
    transition: color 0.2s;
}

.preview-card-link:hover {
    color: var(--preview-primary-600, var(--primary-600));
}

.preview-footer {
    background: var(--bg-secondary);
    padding: var(--space-3) var(--space-4);
    text-align: center;
    border-top: 1px solid var(--border);
}

.preview-footer-text {
    color: var(--text-secondary);
    font-size: var(--text-xs);
}

.preview-controls {
    display: flex;
    gap: var(--space-1);
}

/* ==========================================================================
   CONTRAST CHECKER
   ========================================================================== */
.contrast-checker {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow), var(--glow-sm);
}

.contrast-checker::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(153, 153, 255, 0.05) 0%,
        transparent 50%,
        rgba(0, 245, 212, 0.05) 100%
    );
    pointer-events: none;
}

.contrast-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

@media (max-width: 768px) {
    .contrast-inputs {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
}

.contrast-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.contrast-input-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.contrast-input-label::before {
    content: '';
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    display: inline-block;
}

.contrast-input-row {
    display: flex;
    gap: var(--space-2);
}

.contrast-input-row input[type="color"] {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 0;
    background: transparent;
    transition: all var(--transition);
}

.contrast-input-row input[type="color"]:hover {
    transform: scale(1.05);
    border-color: var(--primary-500);
    box-shadow: var(--glow-sm);
}

.contrast-result {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: var(--space-4);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.contrast-result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        var(--primary-500) 50%,
        transparent 100%
    );
}

.contrast-score {
    font-size: var(--text-3xl);
    font-weight: 800;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(153, 153, 255, 0.3);
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

.contrast-status {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.contrast-badge {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.contrast-badge.pass {
    background: var(--success-glow);
    color: var(--success);
    border-color: rgba(0, 255, 157, 0.3);
    box-shadow: 0 0 8px rgba(0, 255, 157, 0.2);
}

.contrast-badge.pass:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(0, 255, 157, 0.3);
}

.contrast-badge.fail {
    background: var(--error-glow);
    color: var(--error);
    border-color: rgba(255, 107, 107, 0.3);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.2);
}

.contrast-badge.warning {
    background: var(--warning-glow);
    color: var(--warning);
    border-color: rgba(255, 209, 102, 0.3);
    box-shadow: 0 0 8px rgba(255, 209, 102, 0.2);
}

.contrast-visual {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.contrast-sample {
    flex: 1;
    padding: var(--space-3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-base);
    border: 2px solid var(--border);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

.contrast-sample:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.contrast-sample::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity var(--transition);
}

.contrast-sample:hover::after {
    opacity: 1;
    animation: shine 1s infinite;
}

/* ==========================================================================
   EXPORT PANEL
   ========================================================================== */
.export-panel {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow), var(--glow-sm);
}

.export-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-primary);
    z-index: var(--z-elevated);
}

.export-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(26, 26, 42, 0.8);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}

.export-format-tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-secondary);
    padding: var(--space-1);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.export-format-tabs::-webkit-scrollbar {
    display: none;
}

.format-tab {
    padding: var(--space-1) var(--space-2);
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.format-tab:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.format-tab.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.export-content {
    padding: var(--space-4);
}

.export-code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    background: var(--color-space-50);
    border-radius: var(--radius);
    padding: var(--space-3);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-inset);
    color: var(--primary-300);
    position: relative;
}

.export-code::before {
    content: '>_';
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    opacity: 0.5;
}

.export-actions {
    display: flex;
    gap: var(--space-2);
}

/* ==========================================================================
   BUTTONS & ICONS
   ========================================================================== */
.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--bg-elevated);
    border-color: var(--primary-500);
    color: var(--primary-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow), var(--glow-sm);
}

.btn-icon.active {
    background: var(--primary-500);
    color: var(--text-inverse);
    border-color: var(--primary-500);
    box-shadow: var(--glow-sm);
}

.btn-icon.active:hover {
    background: var(--primary-600);
    border-color: var(--primary-600);
    box-shadow: var(--glow);
}

/* Smaller buttons in sidebar */
.sidebar .btn-icon {
    width: 28px;
    height: 28px;
    border-width: 1px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.sidebar .btn-icon:hover {
    transform: translateY(-1px) scale(1.05);
}

.btn-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(153, 153, 255, 0.1) 50%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-icon:hover::before {
    opacity: 1;
    animation: shine 1s infinite;
}

.quick-copy-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 0.9em;
    flex-shrink: 0;
}

.quick-copy-btn:hover {
    color: var(--primary-500);
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

/* Smaller quick copy buttons in sidebar */
.sidebar .quick-copy-btn {
    width: 20px;
    height: 20px;
    padding: 2px;
    font-size: 0.75em;
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================== */
.color-wheel-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    backdrop-filter: blur(4px);
}

.color-wheel-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-elevated);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border-glow);
    box-shadow: var(--shadow-2xl);
    position: relative;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
    font-family: var(--font-display);
}

.modal-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
    justify-content: flex-end;
}

.color-wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: var(--space-4) auto;
}

.color-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #ff0000 0%,
        #ffff00 16.66%,
        #00ff00 33.33%,
        #00ffff 50%,
        #0000ff 66.66%,
        #ff00ff 83.33%,
        #ff0000 100%
    );
    cursor: crosshair;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.color-wheel-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid var(--primary-500);
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl), var(--glow);
    z-index: var(--z-toast);
    transform: translateX(100%);
    opacity: 0;
    transition: transform var(--transition), opacity var(--transition);
    max-width: 300px;
    font-weight: 500;
    backdrop-filter: var(--backdrop-blur);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
    background: var(--success-glow);
}

.toast.error {
    border-color: var(--error);
    background: var(--error-glow);
}

.toast.warning {
    border-color: var(--warning);
    background: var(--warning-glow);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    backdrop-filter: blur(4px);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-radius: 50%;
    border-top-color: var(--primary-500);
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-3);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--text-primary);
    font-size: var(--text-base);
    font-weight: 500;
}

/* ==========================================================================
   TOOLTIPS
   ========================================================================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: var(--z-tooltip);
    pointer-events: none;
    margin-bottom: var(--space-1);
    font-family: var(--font-sans);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Shortcut hint */
.shortcut-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.glass-morphism {
    background: rgba(26, 26, 42, 0.7);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(153, 153, 255, 0.2);
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow-on-hover:hover {
    box-shadow: var(--glow);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--space-2);
    }
    
    .harmony-colors {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-areas:
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr;
    }
    
    .sidebar {
        display: none;
    }
    
    .harmony-colors {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .quick-actions {
        overflow-x: auto;
        padding-bottom: var(--space-2);
        -webkit-overflow-scrolling: touch;
    }
    
    .quick-actions::-webkit-scrollbar {
        height: 4px;
    }
    
    .action-btn {
        min-width: 120px;
    }
    
    .preview-card-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-hero-title {
        font-size: var(--text-xl);
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 60px;
        --space-4: 20px;
    }
    
    .header {
        padding: 0 var(--space-2);
    }
    
    .main-content {
        padding: 0;
    }
    
    .tab-content {
        padding: var(--space-2);
    }
    
    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--space-2);
    }
    
    .harmony-colors {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .export-format-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .contrast-visual {
        flex-direction: column;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .color-history-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   DARK THEME ENHANCEMENTS
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--bg-primary);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border: #666666;
    }
    
    .color-input-section,
    .contrast-checker,
    .export-panel,
    .sidebar-section {
        border-width: 2px;
    }
    
    .tab-button.active {
        border-width: 3px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body::before {
        animation: none;
    }
    
    .logo-icon::before,
    .color-preview-compact::after,
    .harmony-color::after,
    .contrast-sample::after,
    .history-color::after,
    .btn-icon::before {
        animation: none;
        opacity: 0;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .app-container {
        display: block;
        height: auto;
        overflow: visible;
    }
    
    .header,
    .sidebar,
    .quick-actions,
    .section-actions,
    .export-actions,
    .palette-actions,
    .color-actions,
    .tab-navigation,
    .preview-controls {
        display: none !important;
    }
    
    .main-content {
        overflow: visible;
        height: auto;
        padding: 0;
    }
    
    .color-input-section,
    .contrast-checker,
    .export-panel,
    .palette-section,
    .website-preview {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }
    
    .palette-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .palette-color-card {
        width: 100px;
        break-inside: avoid;
    }
    
    .color-preview-compact,
    .palette-swatch {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==========================================================================
   ACCESSIBILITY & FOCUS STATES
   ========================================================================== */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Visually hidden for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Touch device optimizations */
@media (hover: none) {
    .palette-color-card:hover,
    .harmony-color:hover,
    .btn-icon:hover,
    .action-btn:hover,
    .saved-palette:hover,
    .history-color:hover {
        transform: none;
    }
    
    .palette-color-card:active,
    .harmony-color:active,
    .btn-icon:active,
    .action-btn:active {
        transform: scale(0.98);
    }
}

/* Empty states */
.saved-palettes:empty::after {
    content: 'No saved palettes yet';
    display: block;
    text-align: center;
    color: var(--text-tertiary);
    padding: var(--space-4);
    font-style: italic;
}

.color-history-grid:empty::after {
    content: 'No recent colors';
    display: block;
    text-align: center;
    color: var(--text-tertiary);
    padding: var(--space-4);
    font-style: italic;
    grid-column: 1 / -1;
}