/* ==========================================================================
   UWS Photo - Next-Gen AI Image Editor
   Theme: Ultra-Dark Glassmorphism & Cyber-Professional
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-base: #030305;
    --bg-surface: #0a0a0f;
    
    /* Glassmorphism Constants */
    --glass-bg: rgba(20, 20, 25, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --glass-shadow: rgba(0, 0, 0, 0.5);
    
    /* Brand & Accents */
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-glow: rgba(59, 130, 246, 0.4);
    
    --ai-accent-start: #d946ef;
    --ai-accent-end: #8b5cf6;
    --ai-glow: rgba(217, 70, 239, 0.4);
    
    /* Typography */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    
    /* Easing */
    --ease-snappy: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* --- Global Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
    user-select: none;
}

/* --- Ambient Orbs (Cinematic Cyberpunk Glow) --- */
.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(160px);
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
    animation: drift 30s infinite alternate var(--ease-smooth);
    will-change: transform;
}

.orb-1 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--ai-accent-end) 0%, transparent 70%);
    top: -20vw;
    left: -10vw;
}

.orb-2 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    bottom: -30vw;
    right: -15vw;
    animation-delay: -15s;
    animation-direction: alternate-reverse;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5vw, 10vw) scale(1.1); }
    66% { transform: translate(-8vw, 5vw) scale(0.95); }
    100% { transform: translate(2vw, -5vw) scale(1.05); }
}

/* --- Core Layout Container --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 10;
}

/* --- Glass Panel Utility --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 12px 40px var(--glass-shadow);
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    border-bottom: 1px solid var(--glass-border);
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    background: rgba(10, 10, 15, 0.6);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--ai-accent-start));
    border-radius: 10px;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 4px 16px var(--primary-glow);
    position: relative;
}

.brand-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.brand h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.top-menu {
    display: flex;
    gap: 4px;
}

.menu-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s var(--ease-snappy);
}

.menu-item:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.ai-highlight {
    color: #f0abfc;
    background: rgba(217, 70, 239, 0.1);
    border: 1px solid rgba(217, 70, 239, 0.25);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-highlight:hover {
    background: rgba(217, 70, 239, 0.2);
    color: #fff;
    box-shadow: 0 0 16px var(--ai-glow);
    border-color: rgba(217, 70, 239, 0.4);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 24px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-snappy);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* ==========================================================================
   Main Workspace Architecture
   ========================================================================== */
.main-workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* --- Left Toolbar --- */
.left-toolbar {
    width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 16px;
    border-right: 1px solid var(--glass-border);
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-radius: 0;
    background: rgba(10, 10, 15, 0.5);
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.tool-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s var(--ease-snappy);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tool-btn:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
    transform: scale(1.05);
}

.tool-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-hover);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: inset 0 0 16px rgba(59, 130, 246, 0.2), 0 0 12px rgba(59, 130, 246, 0.2);
}

.ai-tool {
    color: #e879f9;
}

.ai-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, var(--ai-accent-start), var(--ai-accent-end));
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 6px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.divider {
    width: 32px;
    height: 1px;
    background: var(--glass-border);
    margin: 8px 0;
}

/* Color Picker Swatches */
.color-picker-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 38px;
    height: 38px;
    margin-top: auto;
    margin-bottom: 12px;
}

.color-box {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid #1e1e2e;
    position: absolute;
    cursor: pointer;
    transition: transform 0.2s var(--ease-snappy);
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.color-box:hover {
    transform: scale(1.15);
    z-index: 5 !important;
}

.bg-color {
    bottom: 0;
    right: 0;
    z-index: 1;
}

.fg-color {
    top: 0;
    left: 0;
    z-index: 2;
}

/* --- Center Canvas Workspace --- */
.center-workspace {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 40px;
}

.canvas-wrapper {
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s var(--ease-smooth);
}

/* Deep Dark Checkerboard for Canvas Background */
.checkerboard-bg {
    background-color: #121212;
    background-image: 
        linear-gradient(45deg, #1c1c1c 25%, transparent 25%, transparent 75%, #1c1c1c 75%, #1c1c1c),
        linear-gradient(45deg, #1c1c1c 25%, transparent 25%, transparent 75%, #1c1c1c 75%, #1c1c1c);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
}

#main-canvas {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
}

/* Zoom Controls Overlay */
.zoom-controls {
    position: absolute;
    bottom: 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 24px;
    border-radius: 30px;
    background: rgba(15, 15, 20, 0.6);
}

.zoom-controls button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s var(--ease-snappy);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.zoom-controls button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.15);
}

#zoom-level {
    font-size: 13px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

/* ==========================================================================
   Right Panel (AI & Layers)
   ========================================================================== */
.right-panel {
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    border-left: 1px solid var(--glass-border);
    overflow-y: auto;
    background: rgba(10, 10, 15, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Elegant Custom Scrollbar */
.right-panel::-webkit-scrollbar {
    width: 6px;
}
.right-panel::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}
.right-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.right-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.panel-section {
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(20, 20, 25, 0.4);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.panel-header h2 {
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

/* AI Assistant Magic Styling */
.ai-header h2 {
    background: linear-gradient(90deg, #60a5fa, #e879f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-tag {
    font-size: 9px;
    background: rgba(217, 70, 239, 0.15);
    color: #f0abfc;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid rgba(217, 70, 239, 0.3);
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.1);
}

.panel-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Prompt Input with Neon Glow on Focus */
#ai-prompt {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    transition: all 0.3s var(--ease-snappy);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}

#ai-prompt:focus {
    outline: none;
    border-color: #d946ef;
    box-shadow: 0 0 0 4px rgba(217, 70, 239, 0.15), inset 0 2px 6px rgba(0,0,0,0.5);
    background: rgba(0, 0, 0, 0.6);
}

#ai-prompt::placeholder {
    color: var(--text-muted);
}

/* AI Generate Button */
.btn-ai {
    background: linear-gradient(135deg, var(--ai-accent-start), var(--ai-accent-end));
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--ease-snappy);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px var(--ai-glow);
    position: relative;
    overflow: hidden;
}

.btn-ai::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
    transform: skewX(-20deg);
    transition: all 0.5s ease;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(217, 70, 239, 0.5);
    filter: brightness(1.1);
}

.btn-ai:hover::before {
    left: 150%;
}

.btn-ai:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Layers Panel --- */
.layers-panel {
    flex: 1;
}

.layer-actions {
    display: flex;
    gap: 8px;
}

.layer-actions button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-actions button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.15);
}

.layer-list {
    padding: 12px;
    gap: 8px;
    overflow-y: auto;
}

/* Layer Items */
.layer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s var(--ease-snappy);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.02);
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.layer-item.active {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.visibility-toggle {
    font-size: 14px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.visibility-toggle:hover {
    color: var(--text-primary);
}

.layer-item.active .visibility-toggle {
    color: var(--primary-hover);
}

/* Layer Thumbnails (Mini Checkerboard) */
.layer-thumbnail {
    width: 44px;
    height: 44px;
    background: #121212;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-image: 
        linear-gradient(45deg, #1f1f2e 25%, transparent 25%, transparent 75%, #1f1f2e 75%, #1f1f2e),
        linear-gradient(45deg, #1f1f2e 25%, transparent 25%, transparent 75%, #1f1f2e 75%, #1f1f2e);
    background-size: 12px 12px;
    background-position: 0 0, 6px 6px;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.8);
    flex-shrink: 0;
}

.ai-thumb {
    border-color: #d946ef;
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.3), inset 0 0 6px rgba(0,0,0,0.8);
}

.layer-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.layer-item.active .layer-name {
    color: #fff;
    font-weight: 600;
}

.lock-icon {
    font-size: 12px;
    color: var(--text-muted);
}
```