/* GLOBAL FIX: Absolute Border-Box Reset */
*, *::before, *::after { box-sizing: border-box; }

/* --- THEME ENGINE --- */
[data-theme="white"] {
    --bg-main: #f9fafb; --sidebar-bg: #ffffff; --card-bg: #ffffff;
    --text-main: #1f2937; --text-muted: #6b7280;
    --accent: #8b3dff; --accent-glow: rgba(139, 61, 255, 0.15);
    --border: #e5e7eb; --canvas-bg: #f3f4f6;
}
[data-theme="neon"] {
    --bg-main: #09090b; --sidebar-bg: #121214; --card-bg: #1c1c1f;
    --text-main: #ffffff; --text-muted: #a1a1aa;
    --accent: #00f3ff; --accent-glow: rgba(0, 243, 255, 0.2);
    --border: #27272a; --canvas-bg: #000000;
}

body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg-main); color: var(--text-main); overflow: hidden; position: fixed; inset: 0;}

/* ANIMATIONS */
@keyframes spin { 100% { transform: rotate(360deg); } }
.auth-spinner { animation: spin 1s linear infinite; display: inline-block; }

/* SIDEBAR & NAVIGATION */
.sidebar { width: 260px; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 24px 20px; flex-shrink: 0; z-index: 2000; transition: width 0.3s, background-color 0.3s; }
.logo { font-size: 28px; font-weight: 900; color: var(--accent); margin-bottom: 35px; text-align: left; padding-left: 10px; letter-spacing: -0.5px;}
.sidebar-menu { display: flex; flex-direction: column; gap: 6px; }
.nav-btn { background: transparent; border: none; color: var(--text-muted); text-align: left; padding: 14px 16px; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 14px; transition: 0.2s; }
.nav-btn i { font-size: 22px; }
.nav-btn:hover { background: var(--bg-main); color: var(--text-main); }
.nav-btn.active { background: var(--accent-glow); color: var(--accent); }
.sidebar-divider { height: 1px; background: var(--border); margin: 25px 0; }

.theme-switch-container { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 16px; background: var(--bg-main); border-radius: 12px; margin-bottom: 12px; font-size: 14px; font-weight: bold; border: 1px solid var(--border);}
.toggle-track { width: 44px; height: 24px; background: #d1d5db; border-radius: 20px; position: relative; cursor: pointer; }
.toggle-ball { width: 18px; height: 18px; background: #fff; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: transform 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.2);}
[data-theme="neon"] .toggle-track { background: var(--accent); }
[data-theme="neon"] .toggle-ball { transform: translateX(20px); }

.user-identity-card { padding: 16px; background: var(--bg-main); border-radius: 12px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--border);}
.user-identity-card i.ph-user-circle { font-size: 34px; color: var(--accent); }
.user-info { display: flex; flex-direction: column; overflow: hidden; flex-grow: 1;}
.user-info span { font-size: 13px; font-weight: bold; color: var(--text-main); }
.user-info .truncate-wallet { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-top: 2px;}

/* MAIN DASHBOARD */
#app-wrapper { display: flex; width: 100%; height: 100%; position: absolute; inset: 0;}
.main-content { flex-grow: 1; padding: 40px 50px; overflow-y: auto; overflow-x: hidden; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 35px; gap: 20px; }

.search-bar-modern { display: flex; align-items: center; background: var(--card-bg); border: 1px solid var(--border); border-radius: 50px; padding: 0 24px; transition: 0.2s ease-in-out; flex-grow: 1; max-width: 500px; height: 48px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);}
[data-theme="neon"] .search-bar-modern { background: #18181b; border-color: #27272a; box-shadow: 0 4px 12px rgba(0,0,0,0.5);}
.search-bar-modern:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.search-bar-modern i { color: var(--text-muted); font-size: 22px; margin-right: 12px;}
.search-bar-modern input { background: transparent; border: none; color: var(--text-main); width: 100%; font-size: 15px; outline: none; font-family: inherit;}

.hero-banner { background: linear-gradient(135deg, var(--accent) 0%, #3b82f6 100%); color: #fff; padding: 48px; border-radius: 24px; margin-bottom: 40px; box-shadow: 0 10px 25px rgba(139, 61, 255, 0.3);}
[data-theme="neon"] .hero-banner { background: linear-gradient(135deg, #1e1b4b 0%, #000000 100%); border: 1px solid #3730a3;}
.hero-banner h1 { margin: 0 0 10px 0; font-size: 32px; letter-spacing: -0.5px;}
.hero-banner p { margin: 0; opacity: 0.9; font-size: 16px;}

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }
.project-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 24px; height: 180px; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);}
.project-card:hover { border-color: var(--accent); transform: translateY(-6px); box-shadow: 0 20px 25px -5px var(--accent-glow); }
.brand-card { align-items: center; justify-content: center; border: 2px dashed var(--border); text-align: center; background: transparent;}
.brand-card:hover { border-style: solid; border-color: var(--accent);}
.book-card { height: 200px; padding: 15px;}
.book-cover-mock { position: absolute; top: 15px; left: 15px; right: 15px; height: 110px; background: rgba(0,0,0,0.05); border-radius: 8px; border: 1px solid var(--border); }

/* ========================================== */
/* GENERAL EDITOR UI                          */
/* ========================================== */
.editor-container { position: absolute; inset: 0; background: var(--bg-main); display: flex; flex-direction: column; z-index: 3000; overflow: hidden;}
.editor-header { height: 65px; background: var(--sidebar-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; }
.header-actions { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }

.editor-body { display: flex; flex: 1; overflow: hidden; position: relative; min-height: 0;}

.canvas-area { flex: 1; display: flex; justify-content: center; align-items: center; background: var(--canvas-bg); overflow: auto; padding: 30px; position: relative; min-height: 0;}
.canvas-shadow-wrapper { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); border-radius: 8px; overflow: hidden; transform-origin: center center; background: #fff;}

.tool-sidebar { width: 160px; background: var(--sidebar-bg); border-left: 1px solid var(--border); padding: 24px 12px; display: flex; flex-direction: column; align-items: center; overflow-y: auto; flex-shrink: 0; min-height: 0; height: 100%;}
.tool-section { width: 100%; border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; flex-shrink: 0;}
.tool-section:last-child { border-bottom: none; }
.tool-section label { font-size: 11px; text-transform: uppercase; font-weight: 800; color: var(--text-muted); margin-bottom: 12px; text-align: center; width: 100%; letter-spacing: 0.5px;}
.layer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }

.layers-list-container { width: 100%; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex-grow: 1; min-height: 0; padding-right: 5px;}
.layer-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-main); border: 1px solid var(--border); padding: 8px; border-radius: 8px; font-size: 12px; cursor: pointer; transition: 0.2s;}
.layer-item:hover { border-color: var(--accent); }
.layer-item.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent);}
.layer-type-icon { font-size: 16px; margin-right: 8px; color: var(--text-muted);}
.layer-name { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.layer-actions { display: flex; gap: 4px; }
.layer-action-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; font-size: 14px; transition: 0.2s;}
.layer-action-btn:hover { color: var(--text-main); }
.layer-action-btn.on { color: var(--accent); }


/* ========================================== */
/* VIDEO EDITOR (THE ABSOLUTE LAYOUT FIX)     */
/* ========================================== */

.video-editor-container { 
    position: absolute; 
    inset: 0; 
    background: var(--bg-main); 
    display: block; 
    z-index: 3000; 
    overflow: hidden;
}

.capcut-header { 
    position: absolute; top: 0; left: 0; right: 0; height: 65px;
    border-bottom: 1px solid var(--border); background: var(--sidebar-bg); 
    display: flex; align-items: center; justify-content: center;
}

.capcut-workspace { 
    position: absolute; 
    top: 65px; 
    bottom: 250px; 
    left: 0; 
    right: 0;
    display: flex; 
    flex-direction: row;
    background: #000; 
    overflow: hidden;
}

/* 1. SLIM LEFT MENU */
.capcut-slim-menu {
    width: 72px; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding-top: 15px; flex-shrink: 0;
}
.slim-menu-item {
    background: none; border: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; font-size: 10px; font-weight: bold; gap: 6px; padding: 14px 0; width: 100%; cursor: pointer; transition: 0.2s;
}
.slim-menu-item i { font-size: 22px; }
.slim-menu-item:hover { color: var(--text-main); }
.slim-menu-item.active { color: var(--accent); }

/* 2. MEDIA POOL PANEL */
.capcut-media-panel {
    width: 280px; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0;
}
.media-pool-grid {
    flex: 1; padding: 15px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow-y: auto; align-content: start;
}
.media-thumb-box { position: relative; width: 100%; aspect-ratio: 16/9; background: #111; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); transition: 0.2s; }
.media-thumb-box:hover { border-color: var(--accent); }
.media-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb-add { position: absolute; bottom: 5px; right: 5px; background: var(--accent); color: #fff; border: none; border-radius: 4px; width: 24px; height: 24px; display: flex; justify-content: center; align-items: center; cursor: pointer; font-size: 14px; transition: 0.2s;}
.media-thumb-add:hover { transform: scale(1.1); }
.media-thumb-dur { position: absolute; bottom: 5px; left: 5px; background: rgba(0,0,0,0.7); color: #fff; font-size: 10px; padding: 2px 4px; border-radius: 4px; font-family: monospace;}


/* 3. CENTER PLAYER PANEL */
.capcut-center-panel {
    flex: 1; display: flex; flex-direction: column; min-width: 0; background: #000;
}
.player-header {
    height: 40px; display: flex; align-items: center; padding-left: 20px; color: var(--text-muted); font-size: 12px; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; flex-shrink: 0;
}
.capcut-player-wrapper { 
    flex: 1; position: relative; margin: 0 20px 10px 20px; display: flex; justify-content: center; align-items: center; overflow: hidden; background: transparent;
}
.capcut-player-wrapper:fullscreen { margin: 0; background: #000; }

#video-preview-canvas, #video-draw-canvas, #video-dom-stack video { 
    max-width: 100%; max-height: 100%; object-fit: contain; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.empty-state-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #111; border-radius: 12px; border: 1px dashed var(--border); z-index: 100;}

/* Player Controls */
.capcut-player-controls {
    height: 50px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; background: #000; flex-shrink: 0; border-top: 1px solid rgba(255,255,255,0.05);
}
.center-play-controls .icon-btn { color: #fff; font-size: 26px; transition: 0.2s; }
.center-play-controls .icon-btn:hover { color: var(--accent); }

/* 4. RIGHT PROPERTIES PANEL */
.capcut-properties-panel {
    width: 300px; background: var(--sidebar-bg); border-left: 1px solid var(--border); padding: 0 20px 20px 20px; flex-shrink: 0; overflow-y: auto; 
}
.capcut-slider-group {
    display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.capcut-slider-group input[type="range"] { width: 130px; }


/* ========================================== */
/* BOTTOM HALF: CAPCUT TIMELINE               */
/* ========================================== */
.capcut-timeline { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    height: 250px; 
    background: var(--sidebar-bg); 
    border-top: 1px solid var(--border); 
    display: flex; 
    flex-direction: column; 
    z-index: 50; 
}

.timeline-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 24px; border-bottom: 1px solid var(--border); font-weight: bold; font-size: 14px; color: var(--text-muted); background: var(--sidebar-bg); flex-shrink: 0;}

/* Scrollable Track Area */
.timeline-scroll-container { display: flex; flex-direction: column; overflow-x: auto; overflow-y: auto; padding: 10px 24px; flex: 1; position: relative;}
.timeline-tracks-wrapper { position: relative; width: 100%; min-width: 800px; height: 100%; display: flex; flex-direction: column;}

/* The ruler at the top of the tracks */
.timeline-ruler {
    height: 24px; border-bottom: 1px solid var(--border); background: var(--bg-main); margin-bottom: 10px; opacity: 0.3; border-radius: 4px; flex-shrink: 0;
}

.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; z-index: 100; pointer-events: none;}
.playhead::before { content: ''; position: absolute; top: -10px; left: -6px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 10px solid #fff;}
input[type=range]#video-scrubber { position: absolute; top: -10px; left: 0; width: 100%; z-index: 101; opacity: 0; cursor: pointer;}

.timeline-track { display: flex; height: 40px; background: var(--bg-main); border-radius: 8px; margin-bottom: 8px; position: relative; border: 1px solid var(--border); flex-shrink: 0;}
.capcut-track-video { height: 60px; } 

.vid-clip { height: 100%; background: #3b82f6; border-radius: 6px; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: bold; cursor: grab; border: 2px solid transparent; transition: border-color 0.1s, box-shadow 0.1s, opacity 0.2s; position: relative; overflow: hidden;}
.vid-clip.dragging { opacity: 0.5; transform: scale(1.02); z-index: 50; box-shadow: 0 10px 20px rgba(0,0,0,0.5); cursor: grabbing;}

.clip-curve-indicator { font-size: 9px; opacity: 0.8; font-weight: normal; margin-top: 2px; display: flex; align-items: center; gap: 4px; z-index: 2; position: relative;}
.vid-clip-text { z-index: 2; position: relative; }

.audio-clip { height: 100%; background: #10b981; border-radius: 6px; position: absolute; display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: bold; cursor: pointer; border: 2px solid transparent; background-size: 100% 100%;}
.text-clip { height: 100%; background: #f59e0b; border-radius: 6px; position: absolute; display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: bold; cursor: pointer; border: 2px solid transparent;}

/* Selection & Trim Handles */
.vid-clip.selected, .audio-clip.selected, .text-clip.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent);}
.vid-clip.selected::before, .vid-clip.selected::after, 
.audio-clip.selected::before, .audio-clip.selected::after,
.text-clip.selected::before, .text-clip.selected::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 10px; background: rgba(255,255,255,0.8); cursor: ew-resize; transition: 0.2s; z-index: 10;
}
.vid-clip.selected::before, .audio-clip.selected::before, .text-clip.selected::before { left: 0; border-top-left-radius: 4px; border-bottom-left-radius: 4px;}
.vid-clip.selected::after, .audio-clip.selected::after, .text-clip.selected::after { right: 0; border-top-right-radius: 4px; border-bottom-right-radius: 4px;}
.vid-clip.selected:hover::before, .vid-clip.selected:hover::after { background: #fff; width: 14px;}


/* ========================================== */
/* DOCUMENT / BOOK EDITOR                     */
/* ========================================== */
.doc-top-toolbar { height: 60px; background: var(--sidebar-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 12px; overflow-x: auto; white-space: nowrap; flex-shrink: 0;}
.toolbar-divider { width: 1px; height: 30px; background: var(--border); margin: 0 5px; flex-shrink: 0;}
.doc-select { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-main); color: var(--text-main); font-family: inherit; font-size: 14px; outline: none; cursor: pointer; font-weight: 600;}
.doc-input-small { width: 60px; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-main); color: var(--text-main); font-family: inherit; font-size: 14px; text-align: center; outline: none; font-weight: 600;}
.doc-color-picker { width: 34px; height: 34px; padding: 0; border: none; border-radius: 6px; cursor: pointer; overflow: hidden; flex-shrink: 0;}
.icon-btn-small { background: transparent; border: 1px solid transparent; color: var(--text-main); padding: 8px; border-radius: 8px; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: 0.2s;}
.icon-btn-small:hover { background: var(--bg-main); border-color: var(--border);}
.icon-btn-small.active { background: var(--accent-glow); color: var(--accent); border-color: var(--accent);}

.doc-left-sidebar { width: 220px; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0;}
.doc-sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px;}
.doc-page-list { flex-grow: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px;}
.doc-page-thumb { width: 100%; aspect-ratio: 8.5 / 11; background: #fff; border: 2px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.05); font-size: 14px; font-weight: bold; color: #aaa;}
.doc-page-thumb:hover { border-color: var(--accent); transform: translateY(-2px);}
.doc-page-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); color: var(--accent);}

.doc-workspace { background: var(--canvas-bg); padding: 30px; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;}
.doc-page-shadow { background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,0.1); border: 1px solid #e5e7eb; transform-origin: top center; transition: width 0.2s, height 0.2s;}
[data-theme="neon"] .doc-page-shadow { border-color: #3f3f46; box-shadow: 0 10px 50px rgba(0,0,0,0.8); }
.doc-right-sidebar { width: 200px; }

/* UI COMPONENTS */
.btn-primary { background: var(--accent); color: #fff; border: none; padding: 12px 24px; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; font-size: 15px; transition: 0.2s; box-shadow: 0 4px 14px var(--accent-glow);}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px);}
.btn-primary-small { background: var(--accent); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 14px;}
.btn-secondary { background: var(--bg-main); border: 1px solid var(--border); color: var(--text-main); padding: 10px 20px; border-radius: 10px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s;}
.btn-secondary-small { background: var(--bg-main); border: 1px solid var(--border); color: var(--text-main); padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 14px;}
.btn-secondary:hover, .btn-secondary-small:hover { border-color: var(--text-muted); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: none; padding: 10px; border-radius: 10px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; transition: 0.2s;}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.tool-icon { width: 100%; aspect-ratio: 1; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 22px; transition: 0.2s; color: var(--text-main);}
.tool-icon.active { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }
.btn-wide { width: 100%; grid-column: span 2; }
.icon-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); padding: 8px; border-radius: 8px; transition: 0.2s;}
.icon-btn:hover { background: var(--bg-main); color: var(--text-main);}
.btn-ghost { background: none; border: none; font-weight: bold; cursor: pointer; color: var(--text-muted); padding: 10px 20px; border-radius: 10px;}
.btn-ghost:hover { background: var(--bg-main); color: var(--text-main);}

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; z-index: 4000; padding: 20px;}
.modal-box { background: var(--card-bg); padding: 40px; border-radius: 24px; width: 100%; max-width: 460px; border: 1px solid var(--border); box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.modal-label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; display: block; letter-spacing: 0.5px; }
.modal-input, .modal-select { width: 100%; padding: 16px; background: var(--bg-main); border: 2px solid transparent; border-radius: 14px; font-family: inherit; font-size: 16px; outline: none; margin-bottom: 24px; transition: 0.2s; color: var(--text-main);}
.modal-input:focus, .modal-select:focus { border-color: var(--accent); background: var(--card-bg); }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 10px;}

.auth-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(10px); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.auth-card { background: var(--card-bg); width: 100%; max-width: 420px; padding: 40px; border-radius: 24px; border: 1px solid var(--border); box-shadow: 0 0 50px var(--accent-glow); text-align: center; }
.auth-logo { font-size: 32px; font-weight: 900; color: var(--accent); margin-bottom: 10px; letter-spacing: -0.5px;}
.auth-logo span { color: var(--text-main); font-weight: 400; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 40px; }
.auth-step { opacity: 0.5; pointer-events: none; transition: 0.3s; display: flex; flex-direction: column; align-items: center; }
.auth-step.active { opacity: 1; pointer-events: auto; }
.btn-auth-google { background: #ffffff; color: #1f2937; border: 1px solid #e5e7eb; padding: 14px 24px; border-radius: 14px; font-weight: bold; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; transition: 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.05); font-family: inherit;}
.btn-auth-google:hover { background: #f9fafb; border-color: #d1d5db; transform: translateY(-2px);}

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;}
::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
    .sidebar { width: 220px; padding: 20px 15px; }
    .doc-left-sidebar { width: 160px; }
    .main-content { padding: 30px; }
}

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .sidebar { width: 100%; height: 70px; flex-direction: row; position: fixed; bottom: 0; left: 0; padding: 0; border-right: none; border-top: 1px solid var(--border); justify-content: space-around; align-items: center; z-index: 2000; padding-bottom: env(safe-area-inset-bottom);}
    .logo, .sidebar-divider, .theme-switch-container, .user-identity-card { display: none; }
    .sidebar-menu { flex-direction: row; width: 100%; justify-content: space-around; padding: 0 10px;}
    .nav-btn { flex-direction: column; gap: 6px; padding: 8px 5px; font-size: 11px; justify-content: center; width: 70px; text-align: center; border-radius: 8px;}
    .nav-btn i { font-size: 24px; margin: 0;}
    .main-content { padding: 20px; margin-bottom: calc(70px + env(safe-area-inset-bottom)); }
    .top-bar { flex-direction: column; align-items: stretch; gap: 15px;}
    .search-bar-modern { max-width: 100%; }
    .editor-body { flex-direction: column-reverse; }
    .tool-sidebar { width: 100%; height: auto; flex-direction: row; overflow-x: auto; padding: 15px 20px; border-left: none; border-top: 1px solid var(--border); gap: 20px; align-items: stretch;}
    .tool-section { width: auto; flex-direction: row; border-bottom: none; border-right: 1px solid var(--border); padding-bottom: 0; padding-right: 20px; margin-bottom: 0; align-items: center; gap: 12px; flex-shrink: 0;}
    .tool-section label { width: auto; margin-bottom: 0; margin-right: 8px; font-size: 12px;}
    .layer-grid { display: flex; flex-direction: row; width: auto; gap: 8px;}
    .tool-icon { width: 44px; height: 44px; }
    .canvas-area { padding: 10px; }
}