/* ===========================
   CRAFTR - Premium Professional UI
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Core Colors — Refined Dark Theme */
    --bg-primary: #09090b;
    --bg-secondary: #0c0c0f;
    --bg-tertiary: #131316;
    --bg-card: #18181b;
    --bg-hover: #1f1f23;
    --bg-elevated: #27272a;

    /* Borders */
    --border-color: #27272a;
    --border-subtle: #1f1f23;
    --border-light: #3f3f46;
    --border-focus: #52525b;

    /* Typography */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-dim: #52525b;

    /* Brand Accents - More Refined */
    --accent-primary: #FABA0B;
    --accent-primary-dim: rgba(250, 186, 11, 0.15);
    --accent-primary-glow: rgba(250, 186, 11, 0.25);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-purple: #8b5cf6;
    --accent-green: #22c55e;
    --accent-green-dim: rgba(34, 197, 94, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    --accent-cyan: #06b6d4;
    --accent-yellow: #eab308;

    /* Typography stacks */
    --font-display: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --editor-font: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", monospace;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.6);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Animation */
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===========================
   SVG Icon System
   =========================== */

/* ===========================
   Global Scrollbar Styling
   =========================== */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(113, 113, 122, 0.3);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(113, 113, 122, 0.5);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(113, 113, 122, 0.3) transparent;
}

/* ===========================
   SVG Icon System
   =========================== */

.icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
}

.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 18px; height: 18px; }
.icon-xl { width: 20px; height: 20px; }

/* ===========================
   Shadow Host
   =========================== */

.craftr-shadow-host {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2147483647;
    pointer-events: none;
}

/* ===========================
   Field Button - Premium Trigger
   =========================== */

.craftr-field-button {
    position: fixed;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    font-size: 14px;
    cursor: pointer;
    z-index: 2147483640;
    pointer-events: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: all var(--duration-fast) var(--ease-out);
    padding: 0;
    opacity: 0.95;
    backdrop-filter: blur(8px);
}

.craftr-field-button:hover {
    opacity: 1;
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: scale(1.05);
    box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.craftr-field-button:active {
    transform: scale(0.98);
}

/* ===========================
   Overlay & Modal
   =========================== */

.craftr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2147483647;
    pointer-events: auto;
    animation: overlayIn var(--duration-normal) var(--ease-out);
}

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

.craftr-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    max-height: 920px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn var(--duration-slow) var(--ease-spring);
    color: var(--text-primary);
    font-family: var(--font-body);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===========================
   Header - Clean & Minimal
   =========================== */

.craftr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

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

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

.craftr-logo-icon {
    height: 28px;
    width: auto;
    opacity: 1;
}

/* Mode Tabs Bar - Vertical tabs left of sidebar */
.mode-tabs-bar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
}

.mode-tabs-bar .mode-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.mode-tabs-bar .mode-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.mode-tabs-bar .mode-tab.active {
    color: var(--accent-primary);
    background: rgba(250, 186, 11, 0.1);
}

.mode-tabs-bar .mode-tab svg {
    width: 18px;
    height: 18px;
}

/* ===========================
   Toolbar - Premium Buttons
   =========================== */

.craftr-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.craftr-toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Premium Button Base */
.craftr-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.craftr-toolbar button svg {
    width: 15px;
    height: 15px;
    opacity: 0.7;
    transition: opacity var(--duration-fast);
}

.craftr-toolbar button:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.craftr-toolbar button:hover svg {
    opacity: 1;
}

.craftr-toolbar button:active {
    transform: scale(0.98);
}

/* Primary Action Button */
.craftr-toolbar button.primary {
    background: var(--accent-primary-dim);
    border-color: rgba(250, 186, 11, 0.3);
    color: var(--accent-primary);
}

.craftr-toolbar button.primary:hover {
    background: rgba(250, 186, 11, 0.25);
    border-color: rgba(250, 186, 11, 0.5);
}

/* Success Button */
.craftr-toolbar button.success {
    background: var(--accent-green-dim);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

.craftr-toolbar button.success:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
}

/* Disabled State */
.craftr-toolbar button:disabled,
.craftr-btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Toolbar Divider */
.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 4px;
}

/* Toolbar Picker Buttons (Upscale, Lens) */
.toolbar-picker-button {
    background: var(--accent-primary-dim) !important;
    border-color: rgba(250, 186, 11, 0.25) !important;
    color: var(--accent-primary) !important;
}

.toolbar-picker-button:hover {
    background: rgba(250, 186, 11, 0.2) !important;
    border-color: rgba(250, 186, 11, 0.4) !important;
}

.toolbar-picker-button svg {
    opacity: 1 !important;
    color: var(--accent-primary);
}

/* Character Counter */
.craftr-char-count {
    margin-left: auto;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

/* ===========================
   Content Area
   =========================== */

.craftr-content-area {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.craftr-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px 24px;
    gap: 16px;
}

/* ===========================
   Footer
   =========================== */

.craftr-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    font-size: 11px;
    color: var(--text-muted);
}

.craftr-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--duration-fast);
}

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

/* ===========================
   Editor Container
   =========================== */

.craftr-editor-container {
    flex: 1;
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.CodeMirror {
    height: 100% !important;
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    font-family: var(--editor-font);
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary);
}

.craftr-editor-container {
    transition: box-shadow 0.15s ease;
}

.craftr-editor-container.drop-target {
    box-shadow: inset 0 0 0 3px var(--accent-primary);
    border-radius: var(--radius);
}

.CodeMirror-gutters {
    background: var(--bg-secondary) !important;
    border-right: 1px solid var(--border-subtle) !important;
}

.CodeMirror-linenumber {
    color: var(--text-dim) !important;
    padding: 0 12px 0 8px !important;
    font-size: 12px;
}

.CodeMirror-cursor {
    border-left: 2px solid var(--accent-primary) !important;
}

.CodeMirror-selected {
    background: rgba(250, 186, 11, 0.12) !important;
}

/* CodeMirror Scrollbars - Minimal & Clean */
.CodeMirror-vscrollbar,
.CodeMirror-hscrollbar {
    outline: none !important;
}

.CodeMirror-vscrollbar::-webkit-scrollbar,
.CodeMirror-hscrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.CodeMirror-vscrollbar::-webkit-scrollbar-track,
.CodeMirror-hscrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.CodeMirror-vscrollbar::-webkit-scrollbar-thumb,
.CodeMirror-hscrollbar::-webkit-scrollbar-thumb {
    background: rgba(113, 113, 122, 0.25);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.CodeMirror-vscrollbar::-webkit-scrollbar-thumb:hover,
.CodeMirror-hscrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(113, 113, 122, 0.4);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.CodeMirror-scrollbar-filler {
    background: transparent !important;
}

/* ===========================
   Smart Edit Bar
   =========================== */

.craftr-smart-edit {
    display: flex;
    gap: 10px;
}

.craftr-smart-edit input {
    flex: 1;
    padding: 12px 16px;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--duration-fast) var(--ease-out);
}

.craftr-smart-edit input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-dim);
}

.craftr-smart-edit input::placeholder {
    color: var(--text-dim);
}

.craftr-smart-edit button {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--accent-blue);
    background: var(--accent-blue-dim);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.craftr-smart-edit button:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

.craftr-smart-edit button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===========================
   Sidebar - Collapsible Categories
   =========================== */

.craftr-sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

/* Search Bar */
.sidebar-search {
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-dim);
    pointer-events: none;
    z-index: 1;
}

.sidebar-search-input {
    width: 100%;
    padding: 9px 12px 9px 32px;
    font-size: 12px;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-out);
}

.sidebar-search-input:focus {
    outline: none;
    border-color: var(--border-light);
    background: var(--bg-card);
}

.sidebar-search-input:focus + .sidebar-search-icon,
.sidebar-search-wrapper:focus-within .sidebar-search-icon {
    color: var(--text-muted);
}

.sidebar-search-input::placeholder {
    color: var(--text-dim);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 16px;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(113, 113, 122, 0.2);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(113, 113, 122, 0.35);
}

/* Section Title */
.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 8px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-title svg {
    width: 12px;
    height: 12px;
    opacity: 0.5;
}

/* Collapsible Category */
.sidebar-category {
    margin-bottom: 4px;
}

/* Section Dividers and Labels */
.sidebar-section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 16px 8px 8px 8px;
}

.sidebar-section-label {
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 0 10px 6px 10px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-section-label svg {
    width: 10px;
    height: 10px;
    color: var(--accent-primary);
    opacity: 0.7;
}

/* Favorites category styling */
.favorites-header span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.favorites-header svg:first-child {
    width: 11px;
    height: 11px;
    color: var(--accent-primary);
    opacity: 0.7;
}

.sidebar-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    user-select: none;
}

.sidebar-category-header:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.sidebar-category-header svg {
    width: 14px;
    height: 14px;
    color: var(--text-dim);
    transition: transform var(--duration-fast) var(--ease-out);
}

.sidebar-category.expanded .sidebar-category-header svg {
    transform: rotate(180deg);
}

.sidebar-category-content {
    display: none;
    padding: 6px 0 6px 8px;
}

.sidebar-category.expanded .sidebar-category-content {
    display: block;
}

/* Style Items */
.style-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin: 2px 0;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: all var(--duration-fast) var(--ease-out);
}

.style-item:active {
    cursor: grabbing;
}

.style-item.dragging {
    opacity: 0.5;
    background: var(--accent-primary);
    color: white;
}

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

.style-item:active {
    background: var(--bg-elevated);
}

.style-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.style-item-heart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
}

.style-item:hover .style-item-heart {
    opacity: 0.6;
}

.style-item-heart:hover {
    opacity: 1 !important;
    color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

.style-item-heart.active {
    opacity: 0.7;
    color: var(--accent-primary);
}

.style-item-heart.active:hover {
    opacity: 1;
    color: var(--text-dim);
    background: var(--bg-hover);
}

.style-item-heart svg {
    width: 11px;
    height: 11px;
}

.style-item-icon {
    width: 4px;
    height: 4px;
    background: var(--text-dim);
    border-radius: 50%;
    flex-shrink: 0;
    transition: all var(--duration-fast);
}

.style-item:hover .style-item-icon {
    background: var(--accent-primary);
    box-shadow: 0 0 6px var(--accent-primary-glow);
}

/* Upscale picker icon - grid symbol */
.style-item-icon.upscale-icon {
    width: 10px;
    height: 10px;
    background: transparent;
    border-radius: 0;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
}

.style-item-icon.upscale-icon::before,
.style-item-icon.upscale-icon::after {
    content: '';
    position: absolute;
}

.style-item-icon.upscale-icon::before {
    top: 0;
    left: 0;
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    box-shadow: 6px 0 0 var(--text-dim), 0 6px 0 var(--text-dim), 6px 6px 0 var(--text-dim);
}

.style-item:hover .style-item-icon.upscale-icon::before {
    background: var(--accent-primary);
    box-shadow: 6px 0 0 var(--accent-primary), 0 6px 0 var(--accent-primary), 6px 6px 0 var(--accent-primary);
}

/* No Results */
.sidebar-no-results {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
}

/* ===========================
   Upscale Picker
   =========================== */

.upscale-picker {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
}

.upscale-picker-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
}

.upscale-picker-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.upscale-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.upscale-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.upscale-tab.active {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.upscale-picker-grid {
    display: grid;
    gap: 4px;
}

.upscale-picker-grid[data-size="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.upscale-picker-grid[data-size="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.upscale-picker-grid[data-size="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.upscale-grid-btn {
    aspect-ratio: 1;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.upscale-grid-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: scale(1.05);
}

/* ===========================
   Focal Length Picker
   =========================== */

.focal-picker {
    min-width: 190px;
}

.focal-grid {
    grid-template-columns: repeat(5, 1fr);
}

.focal-grid .upscale-grid-btn {
    font-size: 9px;
    min-width: 28px;
    min-height: 28px;
}

/* ===========================
   Camera Angle Picker
   =========================== */

.angle-picker {
    min-width: 220px;
}

.angle-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.angle-btn {
    padding: 8px 6px;
    font-size: 10px;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-align: center;
    white-space: nowrap;
}

.angle-btn:hover {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Focal icon - lens symbol */
.style-item-icon.focal-icon {
    width: 10px;
    height: 10px;
    background: transparent;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    position: relative;
}

.style-item-icon.focal-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.style-item:hover .style-item-icon.focal-icon {
    border-color: var(--accent-primary);
    box-shadow: 0 0 6px var(--accent-primary-glow);
}

/* ===========================
   Toast Notifications
   =========================== */

.better-toast {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-green);
    background: var(--bg-card);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 10002;
    animation: toastIn var(--duration-normal) var(--ease-out);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(16px);
    }
}

/* ===========================
   Tooltip System
   =========================== */

.craftr-btn-disabled-wrapper {
    position: relative;
    display: inline-flex;
}

.craftr-btn-disabled-wrapper[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    white-space: nowrap;
    z-index: 2147483647;
    animation: tooltipIn var(--duration-fast) var(--ease-out);
}

@keyframes tooltipIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===========================
   Image Drop Zone
   =========================== */

.CodeMirror.drop-active {
    outline: 2px dashed var(--accent-primary);
    outline-offset: -4px;
}

.image-actions-float {
    position: absolute;
    right: 20px;
    top: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 10001;
}

.image-float-preview {
    grid-column: 1 / -1;
    width: 220px;
    height: 140px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.image-float-status {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 0;
}

.image-actions-float button {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.image-actions-float button:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.image-actions-float.center {
    left: 50%;
    right: auto;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* ===========================
   Syntax Highlighting - Subtle Pastel Theme
   =========================== */

/* Comments - very subtle, unobtrusive */
.cm-s-default .cm-comment { 
    color: #52525b; 
    font-style: italic; 
}
.cm-s-default .cm-comment-section { 
    color: #71717a; 
    font-weight: 500;
    font-style: normal;
}

/* Keywords - soft pastels */
.cm-s-default .cm-keyword-quality { color: #f0abab; }
.cm-s-default .cm-keyword-style { color: #a5b4fc; }
.cm-s-default .cm-keyword-camera { color: #93c5fd; }
.cm-s-default .cm-keyword-negative { color: #71717a; }
.cm-s-default .cm-keyword-attribute { color: #c4b5fd; }
.cm-s-default .cm-keyword-composition { color: #7dd3fc; }
.cm-s-default .cm-keyword-lighting { color: #fcd34d80; }
.cm-s-default .cm-keyword-subject { color: #a5b4fc; }
.cm-s-default .cm-keyword-location { color: #86efac; }
.cm-s-default .cm-keyword-action { color: #a5b4fc; font-style: italic; }

/* Numbers - subtle green */
.cm-s-default .cm-number { color: #86efac; }

/* Camera settings */
.cm-s-default .cm-camera-setting { color: #93c5fd; }

/* Emphasis */
.cm-s-default .cm-emphasis { color: #c4b5fd; font-style: italic; }

/* Video-specific - softer tones */
.cm-s-default .cm-keyword-video { color: #fca5a5; }
.cm-s-default .cm-keyword-movement { color: #fdba74; }
.cm-s-default .cm-keyword-grading { color: #f9a8d4; }
.cm-s-default .cm-keyword-film { color: #c4b5fd; }
.cm-s-default .cm-keyword-temporal { color: #93c5fd; }

/* ===========================
   Video Mode Theme Adjustments
   =========================== */

.craftr-modal.video-mode {
    --accent-primary: #f87171;
    --accent-primary-dim: rgba(248, 113, 113, 0.15);
    --accent-primary-glow: rgba(248, 113, 113, 0.25);
}

/* ===========================
   Utility Classes
   =========================== */

.craftr-close { display: none; }

.hidden { display: none !important; }

/* Smart Edit Button Wrapper */
.craftr-smart-edit-button-wrapper {
    display: inline-flex;
}

/* Grid Category with Size Dropdown */
.grid-category .sidebar-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.grid-category .sidebar-category-header > span:first-child {
    flex: 1;
}

/* Toolbar Row 2 - Tools Row */
.toolbar-tools-row {
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
    margin-top: 2px;
    gap: 12px;
}

/* Keep Style Switch */
.keep-style-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.keep-style-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.keep-style-switch {
    position: relative;
    width: 32px;
    height: 18px;
}

.keep-style-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.keep-style-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    transition: all var(--duration-fast) var(--ease-out);
}

.keep-style-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: all var(--duration-fast) var(--ease-out);
}

.keep-style-checkbox:checked + .keep-style-slider {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.keep-style-checkbox:checked + .keep-style-slider:before {
    transform: translateX(14px);
    background-color: white;
}

.keep-style-switch-wrapper:hover .keep-style-slider {
    border-color: var(--text-muted);
}

.keep-style-switch-wrapper:hover .keep-style-label {
    color: var(--text-secondary);
}

/* Toolbar Tool Wrapper (icon + label + control) */
.toolbar-tool-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-body);
}

.toolbar-tool-wrapper svg {
    flex-shrink: 0;
}

/* Global Grid Size Dropdown */
.global-grid-dropdown {
    font-size: 11px;
    font-family: var(--font-body);
    padding: 3px 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    margin-left: 2px;
}

.global-grid-dropdown:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.global-grid-dropdown:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.grid-type-item {
    cursor: pointer;
}

.grid-size-label {
    margin-left: auto;
    font-size: 9px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* ===========================
   Syntax Highlighting - CRAFTR Prompt Mode
   =========================== */

/* Comments & Headers */
.cm-comment {
    color: #52525b; /* Zinc 600 - Muted */
    font-style: italic;
}

.cm-comment-section {
    color: #FABA0B; /* Primary Brand Orange */
    font-weight: 700;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(250, 186, 11, 0.2);
    display: inline-block;
    width: 100%;
    margin-top: 1em;
    padding-bottom: 0.2em;
}

.cm-comment-header {
    color: #fb923c; /* Orange 400 */
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(251, 146, 60, 0.3);
}

/* Parameters & Technical */
.cm-parameter {
    color: #60a5fa; /* Blue 400 */
    font-weight: 600;
    font-family: var(--font-mono);
}

.cm-weight-value {
    color: #f472b6; /* Pink 400 */
    font-weight: 700;
}

.cm-weight-block {
    background: rgba(244, 114, 182, 0.1);
    color: #f472b6;
    border-radius: 4px;
}

.cm-negative-prompt {
    color: #f87171; /* Red 400 */
    text-decoration: line-through; /* Visual cue for negative */
    opacity: 0.8;
}

.cm-aspect-ratio,
.cm-camera-setting {
    color: #38bdf8; /* Sky 400 */
    font-family: var(--font-mono);
}

.cm-technical-term {
    color: #94a3b8; /* Slate 400 */
}

/* Semantics */
.cm-emphasis {
    color: #facc15; /* Yellow 400 */
    font-weight: 600;
    text-shadow: 0 0 8px rgba(250, 204, 21, 0.1);
}

.cm-keyword-quality {
    color: #fbbf24; /* Amber 400 */
}

.cm-keyword-video,
.cm-keyword-movement,
.cm-keyword-temporal {
    color: #c084fc; /* Purple 400 */
    font-style: italic;
}

.cm-keyword-lighting {
    color: #fcd34d; /* Amber 300 - Light/Sun */
}

.cm-keyword-grading,
.cm-keyword-color {
    color: #2dd4bf; /* Teal 400 */
}

.cm-keyword-camera,
.cm-keyword-film {
    color: #818cf8; /* Indigo 400 */
}

.cm-keyword-composition {
    color: #a78bfa; /* Violet 400 */
}

.cm-keyword-style {
    color: #e879f9; /* Fuchsia 400 */
    font-weight: 500;
}

.cm-keyword-subject {
    color: #fafafa; /* White - Subject stands out */
    font-weight: 600;
}

.cm-keyword-location {
    color: #4ade80; /* Green 400 */
}

.cm-variable {
    color: #22d3ee; /* Cyan 400 */
    font-weight: 700;
    border: 1px dashed rgba(34, 211, 238, 0.3);
    border-radius: 4px;
    padding: 0 2px;
}

.cm-number {
    color: #a5f3fc; /* Cyan 200 */
}

/* REFINEMENTS: Gray Headers + No Strikethrough */
.cm-comment-header {
    color: #a1a1aa !important; /* Zinc 400 - Gray like comments but bold */
    font-weight: normal !important; /* Normal weight as requested */
    text-decoration: none !important;
}

.cm-negative-prompt {
    color: #f87171 !important; /* Red 400 */
    text-decoration: none !important; /* Removed strikethrough */
    background: rgba(248, 113, 113, 0.1);
    border-radius: 4px;
    padding: 0 4px;
}

/* ===========================
   Character Studio Button
   =========================== */

/* Preview Button */
.preview-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: var(--radius);
    color: #a78bfa;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.preview-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(139, 92, 246, 0.35) 100%);
    border-color: rgba(139, 92, 246, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.preview-btn svg {
    width: 14px;
    height: 14px;
}

.character-studio-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent-primary-dim);
    border: 1px solid rgba(250, 186, 11, 0.3);
    border-radius: var(--radius);
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    margin-left: auto;
}

.character-studio-btn:hover {
    background: rgba(250, 186, 11, 0.25);
    border-color: rgba(250, 186, 11, 0.5);
    transform: translateY(-1px);
}

.character-studio-btn svg {
    width: 14px;
    height: 14px;
}

/* ===========================
   Preview Modal - Compact overlay
   =========================== */

.craftr-preview-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.craftr-preview-modal.visible {
    display: flex;
}

.craftr-preview-modal .preview-inner {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.craftr-preview-modal .preview-controls {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.craftr-preview-modal .preview-model-select,
.craftr-preview-modal .preview-aspect-select {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.craftr-preview-modal .preview-model-select:hover,
.craftr-preview-modal .preview-aspect-select:hover {
    border-color: var(--border-light);
}

.craftr-preview-modal .preview-regenerate-btn {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.craftr-preview-modal .preview-regenerate-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.craftr-preview-modal .preview-regenerate-btn svg {
    width: 14px;
    height: 14px;
}

.craftr-preview-modal .preview-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 1002;
}

.craftr-preview-modal .preview-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.craftr-preview-modal .preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.craftr-preview-modal .preview-img {
    max-width: 800px;
    max-height: 800px;
    object-fit: contain;
    border-radius: 6px;
}

.craftr-preview-modal .preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 120px 160px;
}

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

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

/* ===========================
   Character Studio Modal V2
   =========================== */

.craftr-character-studio-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.craftr-character-studio-modal.visible {
    display: flex;
}

.cs-modal-inner {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl), 0 0 100px rgba(250, 186, 11, 0.1);
    width: 1200px;
    max-width: 96vw;
    height: 95vh;
    max-height: 1000px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cs-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.cs-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.cs-title svg {
    color: var(--accent-primary);
}

.cs-tabs {
    display: flex;
    gap: 4px;
    margin-left: 16px;
    flex: 1;
}

.cs-tab {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cs-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.cs-tab.active {
    color: var(--accent-primary);
    background: rgba(249, 115, 22, 0.1);
    border-color: var(--accent-primary);
}

.cs-tab-content {
    display: none;
}

.cs-tab-content.active {
    display: block;
}

.cs-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.cs-close-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Body: Two Column Layout */
.cs-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left Column: Form */
.cs-form-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
    min-width: 0;
}

.cs-form-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cs-section {
    margin-bottom: 20px;
}

.cs-section:last-child {
    margin-bottom: 0;
}

.cs-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.cs-field {
    margin-bottom: 12px;
}

.cs-field:last-child {
    margin-bottom: 0;
}

.cs-field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.cs-field-row:last-child {
    margin-bottom: 0;
}

.cs-field-grow {
    flex: 2;
}

.cs-field-half {
    flex: 1;
}

.cs-field-small {
    flex: 0 0 80px;
}

.cs-label {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cs-input-wrap {
    display: flex;
    gap: 6px;
}

.cs-input-wrap .cs-input {
    flex: 1;
}

.cs-input,
.cs-select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-body);
    transition: all var(--duration-fast) ease;
}

.cs-input:focus,
.cs-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-dim);
}

.cs-input::placeholder {
    color: var(--text-dim);
    font-size: 12px;
}

.cs-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.cs-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Generate Button for each field */
.cs-gen-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary-dim);
    border: 1px solid rgba(250, 186, 11, 0.3);
    border-radius: var(--radius);
    color: var(--accent-primary);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.cs-gen-btn svg {
    width: 14px;
    height: 14px;
}

.cs-gen-btn:hover {
    background: rgba(250, 186, 11, 0.25);
    border-color: rgba(250, 186, 11, 0.5);
    transform: scale(1.05);
}

.cs-gen-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Form Footer */
.cs-form-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
}

.cs-clear-btn {
    padding: 10px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.cs-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.cs-randomize-btn {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.cs-randomize-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.cs-generate-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.cs-generate-btn:hover {
    background: #d16a28;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(250, 186, 11, 0.3);
}

.cs-generate-btn svg {
    width: 14px;
    height: 14px;
}

/* Right Column: Preview */
.cs-preview-column {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    max-height: 100%;
    overflow: hidden;
}

.cs-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.cs-model-select,
.cs-aspect-select {
    padding: 6px 28px 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.cs-model-select:hover,
.cs-aspect-select:hover {
    border-color: var(--border-light);
}

.cs-regenerate-btn {
    padding: 5px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.cs-regenerate-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.cs-regenerate-btn svg {
    width: 12px;
    height: 12px;
}

.cs-preview-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    min-height: 0;
    overflow: hidden;
}

/* Preview Container - Dynamic Aspect Ratio */
.cs-preview-container {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    position: relative;
    overflow: hidden;
}

/* Aspect Ratio Variants - Maximize within container */
.cs-preview-container[data-aspect="16:9"] {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
}

.cs-preview-container[data-aspect="9:16"] {
    width: auto;
    height: 100%;
    max-height: 100%;
    aspect-ratio: 9 / 16;
}

.cs-preview-container[data-aspect="1:1"] {
    width: auto;
    height: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
}

.cs-preview-container[data-aspect="4:3"] {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
}

.cs-preview-container[data-aspect="3:4"] {
    width: auto;
    height: 100%;
    max-height: 100%;
    aspect-ratio: 3 / 4;
}

.cs-preview-container:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

.cs-preview-container.has-image {
    border-style: solid;
    border-color: var(--border-color);
}

.cs-preview-container.has-image:hover {
    border-color: var(--accent-primary);
}

.cs-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.cs-preview-placeholder svg {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
    opacity: 0.6;
}

.cs-preview-placeholder .cs-preview-cta {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.cs-preview-placeholder .cs-preview-hint {
    font-size: 11px;
    color: var(--text-dim);
}

.cs-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

.cs-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

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

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

.cs-preview-info {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.cs-preview-info p {
    margin: 0;
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.5;
}

.cs-preview-info .cs-cost {
    color: var(--text-muted);
    font-weight: 500;
}

/* Randomize button styling */
.cs-randomize-btn svg {
    width: 14px;
    height: 14px;
}

/* Drag & Drop Input Fields */
.cs-input-wrap.can-drop {
    position: relative;
}

.cs-input-wrap.can-drop .cs-input {
    padding-right: 70px;
}

.cs-input-wrap .cs-drop-hint {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-dim);
    pointer-events: none;
    opacity: 0.6;
}

.cs-input-wrap.dragging {
    background: var(--accent-primary-dim);
    border-radius: var(--radius);
}

.cs-input-wrap.dragging .cs-input {
    border-color: var(--accent-primary);
    background: transparent;
}

.cs-input-wrap .cs-analyzing {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.cs-analyzing-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: cs-spin 0.6s linear infinite;
}

/* Preview Actions (Button unter Preview) */
.cs-preview-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: center;
}

.cs-preview-btn {
    padding: 10px 24px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.cs-preview-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.cs-preview-btn svg {
    width: 14px;
    height: 14px;
}

/* Use Button kleiner */
.cs-generate-btn {
    padding: 8px 16px !important;
    font-size: 12px !important;
}

/* Lightbox */
.cs-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cs-lightbox.visible {
    opacity: 1;
}

.cs-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

.cs-lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-lightbox-content img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cs-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.cs-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ========== ADAPTIVE LAYOUT FOR LANDSCAPE ASPECTS ========== */
/* Landscape: Modal wird breiter, Preview-Spalte wird breiter */
.cs-modal-inner.layout-landscape {
    width: 1500px;
    max-width: 98vw;
}

/* Preview-Spalte breiter fuer Landscape-Bilder */
.cs-modal-inner.layout-landscape .cs-preview-column {
    width: 580px;
}

/* Preview-Container fuer Landscape optimal */
.cs-modal-inner.layout-landscape .cs-preview-image {
    padding: 20px;
    align-items: flex-start;
    padding-top: 40px;
}

.cs-modal-inner.layout-landscape .cs-preview-container[data-aspect="16:9"],
.cs-modal-inner.layout-landscape .cs-preview-container[data-aspect="4:3"] {
    width: 100%;
    height: auto;
    max-height: none;
}
