/* ==========================================================================
   Comic Generator Suite v3.0 — Styles
   ========================================================================== */

/* Alpine.js Cloak - Hide elements until Alpine loads */
[x-cloak] { display: none !important; }

/* --------------------------------------------------------------------------
   CSS Variables / Theme
   -------------------------------------------------------------------------- */
:root {
    /* EAH Branding Colors */
    --color-primary: #00a5b5;
    --color-primary-dark: #008a98;
    --color-primary-light: #33b7c4;
    --color-accent: #ff6b35;
    --color-accent-dark: #e55a28;
    
    /* Module Colors */
    --color-katalog: #9b59b6;
    --color-story: #3498db;
    --color-generator: #e67e22;
    --color-publisher: #27ae60;
    
    /* Neutrals */
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;
    --color-border: #e1e5e9;
    --color-border-light: #f0f2f4;
    
    /* Text */
    --color-text: #1a1a2e;
    --color-text-secondary: #5a6170;
    --color-text-muted: #8a919c;
    --color-text-inverse: #ffffff;
    
    /* Status */
    --color-success: #27ae60;
    --color-warning: #f39c12;
    --color-error: #e74c3c;
    --color-info: #3498db;
    
    /* Typography */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Sizing */
    --header-height: 88px;
    --footer-height: 0px;
    --sidebar-width: 280px;
    
    /* Effects */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(0, 165, 181, 0.15);
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Dark Mode */
.dark-mode {
    --color-bg: #0f0f1a;
    --color-surface: #1a1a2e;
    --color-surface-elevated: #252540;
    --color-border: #2d2d4a;
    --color-border-light: #1f1f35;
    
    --color-text: #f0f0f5;
    --color-text-secondary: #a0a5b5;
    --color-text-muted: #6a7085;
    
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    color: var(--color-text-secondary);
}

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

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

/* --------------------------------------------------------------------------
   Layout: Header
   -------------------------------------------------------------------------- */
.app-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

/* Top Row: Branding */
.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.brand-icon {
    font-size: 1.25rem;
}

.brand-title {
    font-size: 1.125rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-version {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-surface);
    padding: 2px 6px;
    border-radius: var(--radius-full);
}

/* Bottom Row: Navigation + Actions */
.header-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) var(--space-lg);
    position: relative;
}

/* Navigation Tabs */
.header-nav {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.header-nav::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

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

.nav-tab.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-md);
}

.nav-icon {
    font-size: 1rem;
}

.nav-label {
    display: inline;
}

/* Medium screens - smaller text */
@media (max-width: 900px) {
    .nav-tab {
        padding: var(--space-xs) 6px;
        font-size: 0.75rem;
        gap: 3px;
    }

    .nav-icon {
        font-size: 0.9375rem;
    }
}

/* Small screens - icons only */
@media (max-width: 600px) {
    .header-top {
        padding: var(--space-xs) var(--space-md);
    }

    .header-bottom {
        padding: var(--space-xs) var(--space-sm);
    }

    .nav-label {
        display: none;
    }

    .nav-tab {
        padding: var(--space-sm);
    }

    .nav-icon {
        font-size: 1.125rem;
    }

    .header-actions {
        right: var(--space-sm);
    }
}

/* Header Actions - positioned absolute right */
.header-actions {
    position: absolute;
    right: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: var(--space-sm);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--color-bg);
    border-color: var(--color-border);
}

.btn-icon.active {
    background: var(--color-surface-elevated);
    border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Layout: Main Content
   -------------------------------------------------------------------------- */
.app-main {
    flex: 1;
    padding: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* View Sections */
.view {
    animation: fadeIn var(--transition-normal);
}

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

.view-header {
    margin-bottom: var(--space-xl);
}

.view-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.view-icon {
    font-size: 1.5rem;
}

.view-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
}

.view-content {
    display: grid;
    gap: var(--space-lg);
}

/* --------------------------------------------------------------------------
   Placeholder Cards (Phase 1)
   -------------------------------------------------------------------------- */
.placeholder-card {
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    position: relative;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.8;
}

.placeholder-card h3 {
    margin-bottom: var(--space-sm);
}

.placeholder-card p {
    max-width: 400px;
    margin: 0 auto var(--space-lg);
}

.placeholder-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.placeholder-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   Katalog Layout (Phase 2)
   -------------------------------------------------------------------------- */
.katalog-layout {
    display: grid;
    grid-template-columns: 200px minmax(280px, 350px) 1fr;
    gap: var(--space-lg);
    height: calc(100vh - var(--header-height) - var(--footer-height) - 140px);
    min-height: 500px;
}

@media (max-width: 1200px) {
    .katalog-layout {
        grid-template-columns: 180px minmax(240px, 300px) 1fr;
    }
}

@media (max-width: 960px) {
    .katalog-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }
}

/* Sidebar / Kategorien */
.katalog-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.kategorie-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.kategorie-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

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

.kategorie-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.kategorie-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.kategorie-label {
    flex: 1;
    font-weight: 500;
}

.kategorie-count {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.kategorie-btn.active .kategorie-count {
    background: rgba(255, 255, 255, 0.2);
}

.katalog-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: auto;
}

.katalog-actions .btn {
    flex: 1;
    font-size: 0.8125rem;
}

@media (max-width: 960px) {
    .kategorie-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .kategorie-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .kategorie-label {
        flex: none;
    }
}

/* Element-Liste */
.katalog-liste {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.liste-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.liste-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.liste-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.liste-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.liste-empty .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.liste-empty p {
    margin-bottom: var(--space-md);
}

.element-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.element-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.element-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.element-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 165, 181, 0.15);
}

/* Card Header */
.element-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.element-icon {
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.element-title {
    flex: 1;
    min-width: 0;
}

.element-name {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.element-id {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.element-actions {
    display: flex;
    gap: var(--space-xs);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.element-card:hover .element-actions {
    opacity: 1;
}

/* Card Body */
.element-body {
    padding: var(--space-md);
}

.element-prompt {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin: 0;
    /* Show up to 4 lines */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Footer */
.element-footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.element-tag {
    font-size: 0.6875rem;
    padding: 2px 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-muted);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon-sm:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
}

.btn-icon-sm.danger:hover {
    background: var(--color-error);
    border-color: var(--color-error);
    color: white;
}

/* Detail Panel */
.katalog-detail {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 400px;
}

.detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.detail-empty .empty-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* Detail View Mode */
.detail-view {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: 100%;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.detail-icon {
    font-size: 2rem;
}

.detail-header h3 {
    font-size: 1.25rem;
}

.detail-section {
    margin-bottom: var(--space-lg);
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.detail-code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-primary);
    background: var(--color-bg);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.detail-prompt {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    white-space: pre-wrap;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-primary-dark);
    background: rgba(0, 165, 181, 0.1);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.detail-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border-light);
}

/* Detail Editor Mode */
.detail-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.editor-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.editor-header h3 {
    font-size: 1rem;
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.editor-content .form-group {
    margin-bottom: var(--space-md);
}

.detail-editor .form-group {
    padding: 0;
}

.form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 120px;
    transition: all var(--transition-fast);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 165, 181, 0.15);
}

.form-input.mono {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.editor-actions {
    flex-shrink: 0;
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.editor-actions .btn {
    flex: 1;
}

/* Icon Picker */
.icon-picker {
    position: relative;
}

.icon-preview {
    width: 60px;
    height: 60px;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-preview:hover {
    border-color: var(--color-primary);
    background: var(--color-surface);
}

.emoji-picker {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    width: 340px;
    max-height: 320px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    margin-top: var(--space-xs);
}

/* New Emoji Picker Layout */
.icon-picker-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.icon-input {
    width: 80px !important;
    text-align: center;
    font-size: 1.5rem;
}

.form-hint-inline {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.emoji-picker-container {
    position: relative;
    margin-top: var(--space-sm);
}

.emoji-picker-dropdown {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-sm);
    max-height: 280px;
    overflow-y: auto;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    padding: var(--space-sm);
}

.emoji-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.emoji-btn:hover {
    background: var(--color-bg);
}

/* Button sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

/* Label styled as button (for file inputs) */
label.btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

label.btn:hover {
    opacity: 0.9;
}

/* --------------------------------------------------------------------------
   Story Layout (Phase 3)
   -------------------------------------------------------------------------- */
.story-layout {
    display: grid;
    grid-template-columns: 220px 1fr 340px;
    gap: var(--space-lg);
    height: calc(100vh - var(--header-height) - var(--footer-height) - 140px);
    min-height: 500px;
}

@media (max-width: 1200px) {
    .story-layout {
        grid-template-columns: 200px 1fr 300px;
    }
}

@media (max-width: 960px) {
    .story-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }
}

/* Story Sidebar */
.story-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.sidebar-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.story-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.story-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    background: var(--color-bg);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.story-item:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
}

.story-item.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.story-item.active .story-meta {
    color: rgba(255,255,255,0.8);
}

.story-item-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.story-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.story-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.story-item:hover .story-item-actions {
    opacity: 1;
}

.story-item.active .story-item-actions {
    opacity: 1;
}

.story-item.active .btn-icon-sm {
    background: rgba(255,255,255,0.2);
    border-color: transparent;
    color: white;
}

.sidebar-actions {
    padding: var(--space-md);
    border-top: 1px solid var(--color-border);
}

/* Story Main Content */
.story-main {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.story-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.story-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.story-empty h3 {
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.story-empty p {
    margin-bottom: var(--space-lg);
}

/* Story Editor */
.story-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.story-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.story-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.story-title-row h3 {
    font-size: 1.125rem;
}

.story-header-actions {
    display: flex;
    gap: var(--space-sm);
}

.story-description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 2px;
    background: var(--color-surface);
    padding: 3px;
    border-radius: var(--radius-md);
    width: fit-content;
}

.toggle-btn {
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-family: inherit;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.toggle-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

/* Panel Toolbar */
.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.toolbar-info {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.scroll-hint {
    color: var(--color-primary);
    font-weight: 500;
    animation: pulse-hint 2s infinite;
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Storyboard Grid */
.storyboard-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    /* Max 2 Reihen sichtbar, dann scrollen */
    max-height: 520px;
}

.panels-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    text-align: center;
    color: var(--color-text-muted);
}

.panels-empty p {
    margin-bottom: var(--space-md);
}

.storyboard-grid {
    display: grid;
    /* Genau 3 Spalten */
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

/* Responsive: 2 Spalten auf mittleren Bildschirmen */
@media (max-width: 1100px) {
    .storyboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .storyboard-container {
        max-height: 480px;
    }
}

/* Responsive: 1 Spalte auf kleinen Bildschirmen */
@media (max-width: 700px) {
    .storyboard-grid {
        grid-template-columns: 1fr;
    }
    .storyboard-container {
        max-height: 400px;
    }
}

.storyboard-card {
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.storyboard-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.storyboard-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 165, 181, 0.2);
}

.storyboard-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-surface);
    font-size: 0.75rem;
    font-weight: 600;
}

.panel-number {
    color: var(--color-primary);
}

.panel-index {
    color: var(--color-text-muted);
}

.card-preview {
    aspect-ratio: 1;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-text-muted);
}

.preview-placeholder .placeholder-icon {
    font-size: 2rem;
    opacity: 0.3;
}

.card-info {
    padding: var(--space-sm);
}

.panel-desc {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-xs);
    line-height: 1.4;
}

.panel-meta {
    display: flex;
    gap: var(--space-sm);
}

.meta-badge {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    background: var(--color-surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* List View */
.list-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    max-height: calc(100vh - 280px);
}

/* Scrollbar für List-Container */
.list-container::-webkit-scrollbar {
    width: 8px;
}

.list-container::-webkit-scrollbar-track {
    background: var(--color-bg);
}

.list-container::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.list-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.panel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

/* Sticky Header für Panel-Tabelle */
.panel-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.panel-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--color-bg);
}

.panel-table th,
.panel-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.panel-table tbody tr {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.panel-table tbody tr:hover {
    background: var(--color-bg);
}

.panel-table tbody tr.selected {
    background: rgba(0, 165, 181, 0.1);
}

.status-badge {
    display: inline-block;
    width: 20px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.status-badge.success {
    color: var(--color-success);
}

/* Panel Sidebar (Editor) */
.panel-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: calc(100vh - 180px);
}

.panel-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding-bottom: var(--space-lg);
}

/* Scrollbar Styling für Panel-Editor */
.panel-editor::-webkit-scrollbar {
    width: 8px;
}

.panel-editor::-webkit-scrollbar-track {
    background: var(--color-bg);
}

.panel-editor::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.panel-editor::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.panel-editor .editor-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-surface);
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.panel-editor .form-group {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-md);
}

.panel-editor .form-group:first-of-type {
    margin-top: var(--space-md);
}

.panel-editor .form-row {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-md);
}

.panel-editor .form-row:first-of-type {
    margin-top: var(--space-md);
}

.panel-editor .form-row .form-group {
    padding: 0;
    margin-bottom: 0;
}

/* Element Selector - Table Layout mit Radiobuttons */
.element-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 350px;
    overflow-y: auto;
}

/* Scrollbar für Element-Table */
.element-table::-webkit-scrollbar {
    width: 6px;
}

.element-table::-webkit-scrollbar-track {
    background: var(--color-bg);
}

.element-table::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.element-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.element-row:last-child {
    border-bottom: none;
}

.element-row-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: var(--space-sm);
    background: var(--color-bg);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    border-right: 1px solid var(--color-border-light);
}

.element-row-options {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: var(--space-xs);
    background: var(--color-surface);
    align-content: flex-start;
}

/* Radio/Checkbox Items */
.radio-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 0.8125rem;
}

.radio-item:hover {
    background: var(--color-bg);
}

.radio-item input[type="radio"],
.radio-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--color-text);
}

.radio-label.muted {
    color: var(--color-text-muted);
    font-style: italic;
}

.radio-icon {
    font-size: 1rem;
}

.radio-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.no-elements {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
    padding: var(--space-xs);
}

/* Form Input Small */
.form-input-sm {
    padding: 6px var(--space-sm);
    font-size: 0.875rem;
}

.form-select-sm {
    padding: 4px 8px;
    font-size: 0.8125rem;
}

/* Dialogue Editor */
.dialogue-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.no-dialogues {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.dialogue-item {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.dialogue-type {
    width: 90px;
    flex-shrink: 0;
}

.dialogue-text {
    flex: 1;
    font-size: 0.8125rem;
}

.btn-add-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.875rem;
    font-weight: bold;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: var(--space-sm);
    transition: background var(--transition-fast);
}

.btn-add-small:hover {
    background: var(--color-primary-dark);
}

/* Prompt Preview */
.prompt-preview {
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
    background: var(--color-bg);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Generator Layout (Phase 4)
   -------------------------------------------------------------------------- */
.generator-layout {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    gap: var(--space-lg);
    height: calc(100vh - var(--header-height) - var(--footer-height) - 140px);
    min-height: 500px;
}

@media (max-width: 1200px) {
    .generator-layout {
        grid-template-columns: 180px 1fr 240px;
    }
}

@media (max-width: 960px) {
    .generator-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }
}

/* Generator Sidebar */
.generator-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: calc(100vh - 160px);
}

.sidebar-section {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.sidebar-section:last-child {
    border-bottom: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.sidebar-section h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

/* Generator Panel List */
.generator-panel-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--space-sm);
    padding-right: var(--space-xs);
}

/* Scrollbar für Generator Panel List */
.generator-panel-list::-webkit-scrollbar {
    width: 8px;
}

.generator-panel-list::-webkit-scrollbar-track {
    background: var(--color-bg);
    border-radius: 4px;
}

.generator-panel-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.generator-panel-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.generator-panel-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs);
    background: var(--color-bg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.generator-panel-item:hover {
    border-color: var(--color-border);
}

.generator-panel-item.selected {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.generator-panel-item.has-image {
    border-left: 3px solid var(--color-success);
}

.generator-panel-item.in-queue {
    border-left: 3px solid var(--color-warning);
}

.panel-item-preview {
    width: 36px;
    height: 36px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.panel-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.preview-empty {
    font-size: 1rem;
    opacity: 0.4;
}

.panel-item-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-item-label {
    font-size: 0.8125rem;
    font-weight: 500;
}

.panel-item-status {
    font-size: 0.75rem;
}

.batch-actions {
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border-light);
}

/* Generator Main */
.generator-main {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.generator-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.generator-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.generator-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: var(--space-lg);
    overflow-y: auto;
}

.generator-header {
    margin-bottom: var(--space-lg);
}

.generator-header h3 {
    font-size: 1.125rem;
    margin-bottom: var(--space-xs);
}

.generator-header .text-muted {
    color: var(--color-text-muted);
    font-weight: normal;
}

.panel-description {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* Prompt Section */
.prompt-section {
    margin-bottom: var(--space-lg);
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.prompt-actions {
    display: flex;
    gap: var(--space-xs);
}

.prompt-textarea {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
}

/* Options Row */
.options-row {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.option-group {
    flex: 1;
    min-width: 120px;
}

.option-group .form-label {
    font-size: 0.75rem;
    margin-bottom: var(--space-xs);
}

/* Generate Actions */
.generate-actions {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

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

.btn-ghost {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.btn-ghost:hover {
    background: var(--color-bg);
    border-color: var(--color-border);
}

.btn-ghost.danger:hover {
    color: var(--color-error);
    border-color: var(--color-error);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Warning Box */
.warning-box {
    padding: var(--space-md);
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    color: var(--color-warning);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}

.warning-box a {
    color: inherit;
    text-decoration: underline;
}

/* Current Image Section */
.current-image-section {
    margin-top: auto;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border-light);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.section-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
}

.current-image {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg);
}

.current-image img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.image-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* Generator Queue */
.generator-queue {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.queue-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.queue-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.queue-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.queue-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.queue-item.processing {
    background: rgba(0, 165, 181, 0.1);
    border: 1px solid var(--color-primary);
}

.queue-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.queue-item-label {
    font-size: 0.8125rem;
    font-weight: 500;
}

.queue-item-status {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.queue-actions {
    padding: var(--space-md);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--space-sm);
}

.queue-footer {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border-light);
    text-align: center;
}

.images-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Publisher Layout (Phase 5)
   -------------------------------------------------------------------------- */
.publisher-layout {
    display: grid;
    grid-template-columns: 220px 1fr 240px;
    gap: var(--space-lg);
    height: calc(100vh - var(--header-height) - var(--footer-height) - 140px);
    min-height: 500px;
}

@media (max-width: 1200px) {
    .publisher-layout {
        grid-template-columns: 180px 1fr 200px;
    }
}

@media (max-width: 960px) {
    .publisher-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }

    .publisher-sidebar {
        max-height: 400px;
    }
}

/* Publisher Sidebar */
.publisher-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    min-height: 200px;
}

/* Scrollbar für Publisher Sidebar */
.publisher-sidebar::-webkit-scrollbar {
    width: 8px;
}

.publisher-sidebar::-webkit-scrollbar-track {
    background: var(--color-bg);
    border-radius: 4px;
}

.publisher-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.publisher-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.publisher-sidebar > .sidebar-section:first-child {
    flex-shrink: 0;
}

.publisher-sidebar .page-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: var(--space-xs);
}

/* Scrollbar für Page List */
.publisher-sidebar .page-list::-webkit-scrollbar {
    width: 8px;
}

.publisher-sidebar .page-list::-webkit-scrollbar-track {
    background: var(--color-bg);
    border-radius: 4px;
}

.publisher-sidebar .page-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.publisher-sidebar .page-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.page-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-item:hover {
    border-color: var(--color-border);
}

.page-item.selected {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.page-item-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.page-item-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Layout Options */
.layout-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.grid-selector {
    display: flex;
    gap: 4px;
}

.grid-btn {
    flex: 1;
    padding: var(--space-sm);
    font-size: 0.8125rem;
    font-family: inherit;
    font-weight: 500;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.grid-btn:hover {
    border-color: var(--color-primary);
}

.grid-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.checkbox-setting {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    cursor: pointer;
    padding: var(--space-xs) 0;
}

.checkbox-setting input {
    accent-color: var(--color-primary);
}

/* Publisher Main */
.publisher-main {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.publisher-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.publisher-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

/* Page Preview */
.page-preview-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: var(--space-md);
}

.page-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.page-preview-header h3 {
    font-size: 1rem;
}

.preview-actions {
    display: flex;
    gap: var(--space-sm);
}

.page-preview {
    flex: 1;
    display: grid;
    gap: var(--space-sm);
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    overflow: hidden;
    --panel-border: var(--color-border);
}

/* Layout Grid Variants */
.page-preview.layout-2x2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.page-preview.layout-2x3 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.page-preview.layout-3x3 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* Format Variants */
.page-preview.format-a4-portrait {
    aspect-ratio: 210 / 297;
    max-height: 100%;
    margin: 0 auto;
}

.page-preview.format-a4-landscape {
    aspect-ratio: 297 / 210;
    max-width: 100%;
    margin: auto 0;
}

.page-preview.format-a5-portrait {
    aspect-ratio: 148 / 210;
    max-height: 100%;
    margin: 0 auto;
}

.page-preview.format-a5-landscape {
    aspect-ratio: 210 / 148;
    max-width: 100%;
    margin: auto 0;
}

.page-preview.format-square {
    aspect-ratio: 1;
    max-height: 100%;
    margin: 0 auto;
}

.page-preview.format-us-letter {
    aspect-ratio: 8.5 / 11;
    max-height: 100%;
    margin: 0 auto;
}

/* Preview Panel */
.preview-panel {
    position: relative;
    background: var(--color-bg);
    border: 2px solid var(--panel-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-panel.empty-slot {
    border-style: dashed;
    opacity: 0.5;
}

.preview-panel.no-image {
    border-style: dashed;
}

.preview-panel.has-caption {
    /* Kein weißer Hintergrund mehr nötig - Caption ist jetzt Overlay */
}

/* Bild-Bereich nimmt gesamten Platz */
.panel-image {
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #fff; /* Weißer Hintergrund für Letterbox/Pillarbox */
}

/* Bild komplett anzeigen mit Letterbox/Pillarbox */
.panel-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Bild vollständig anzeigen */
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
}

/* Alternativ: Bild füllt Bereich (schneidet ab) */
.panel-image.image-cover img {
    object-fit: cover;
}

/* Globaler Toggle: Wenn body.image-fit-cover gesetzt ist */
body.image-fit-cover .panel-image img,
body.image-fit-cover .card-preview img,
body.image-fit-cover .panel-item-preview img,
body.image-fit-cover .panel-item-thumb img,
body.image-fit-cover .polaroid-img,
body.image-fit-cover .history-thumb img {
    object-fit: cover;
}

/* Bei Caption: Bild komplett anzeigen */
.preview-panel.has-caption .panel-image img {
    object-fit: contain;
}

.panel-loading {
    font-size: 1.5rem;
}

.panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
}

.panel-placeholder span {
    font-size: 1.5rem;
    opacity: 0.5;
}

.panel-placeholder small {
    font-size: 0.625rem;
    margin-top: 4px;
}

/* Panel Number Badge */
.panel-number-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.625rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Panel Dialogues */
.panel-dialogues {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dialogue-bubble {
    background: white;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.5rem;
    line-height: 1.3;
    max-width: 90%;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.dialogue-bubble.type-thought {
    border-radius: 12px;
    border-style: dotted;
}

.dialogue-bubble.type-shout {
    background: #fff3cd;
    border-color: #856404;
    font-weight: bold;
}

.dialogue-bubble.type-narration {
    background: #f8f9fa;
    border: none;
    font-style: italic;
    text-align: center;
}

/* Publisher Export */
.publisher-export {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.export-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.export-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.export-options {
    flex: 1;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.export-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.btn-block {
    width: 100%;
    margin-bottom: var(--space-xs);
}

.export-info {
    padding: var(--space-md);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
}

.info-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.stat-row span {
    color: var(--color-text-muted);
}

.stat-row strong {
    color: var(--color-text);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 1.125rem;
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

/* Liste Empty Small */
.liste-empty.small {
    padding: var(--space-lg);
}

.liste-empty.small .empty-icon {
    font-size: 2rem;
}

/* --------------------------------------------------------------------------
   Settings View
   -------------------------------------------------------------------------- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.settings-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.settings-card-title {
    font-size: 1.125rem;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.settings-divider {
    border: none;
    border-top: 1px solid var(--color-border-light);
    margin: var(--space-lg) 0;
}

/* Info Grid */
.info-grid {
    display: grid;
    gap: var(--space-md);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.info-value {
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */
.form-group {
    margin-bottom: var(--space-md);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 165, 181, 0.15);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* Color Input */
.color-input-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-color {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.form-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-value {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border-color: var(--color-border);
}

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

.btn-danger {
    background: transparent;
    color: var(--color-error);
    border-color: var(--color-error);
}

.btn-danger:hover {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

/* --------------------------------------------------------------------------
   Layout: Footer
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-primary);
}

.toast-success { border-left-color: var(--color-success); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-error { border-left-color: var(--color-error); }

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    font-size: 0.9375rem;
    color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Selection */
::selection {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

/* ==========================================================================
   Editor View (Phase 4.5)
   ========================================================================== */

.editor-layout {
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    gap: var(--space-lg);
    height: calc(100vh - 180px);
    min-height: 500px;
}

/* Editor Sidebar */
.editor-sidebar {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    overflow-y: auto;
    border: 1px solid var(--color-border);
}

.editor-panel-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 400px;
    overflow-y: auto;
}

.editor-panel-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--color-bg);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.editor-panel-item:hover {
    background: var(--color-border-light);
}

.editor-panel-item.selected {
    background: var(--color-primary);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border-color: var(--color-primary-dark);
}

.editor-panel-item.has-bubbles .panel-item-label::after {
    content: '💬';
    margin-left: 4px;
    font-size: 0.75rem;
}

.panel-item-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--color-border-light);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.panel-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.panel-item-thumb .no-image-icon {
    font-size: 1.25rem;
    opacity: 0.5;
}

.panel-item-info {
    flex: 1;
    min-width: 0;
}

.panel-item-label {
    font-weight: 600;
    font-size: 0.875rem;
}

.panel-item-badges {
    display: flex;
    gap: var(--space-xs);
}

.badge-bubble {
    font-size: 0.7rem;
    background: var(--color-warning);
    color: white;
    padding: 1px 4px;
    border-radius: 8px;
}

.panel-nav-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.panel-counter {
    flex: 1;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* Editor Main Area */
.editor-main-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0;
}

.editor-empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-text-secondary);
}

.editor-empty-state .empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* Polaroid Editor */
.polaroid-editor-container {
    width: 100%;
    max-width: 600px;
}

.polaroid-card-large {
    background: white;
    border-radius: 4px;
    box-shadow: 
        0 4px 6px rgba(0,0,0,0.1),
        0 10px 20px rgba(0,0,0,0.08),
        4px 4px 0 rgba(0,0,0,0.1);
    padding: 12px;
}

/* Editor Publish Bar */
.editor-publish-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
}

.btn-publish {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 165, 181, 0.3);
}

.btn-publish:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 165, 181, 0.4);
}

.btn-publish:disabled {
    background: var(--color-border);
    cursor: not-allowed;
    box-shadow: none;
}

.publish-icon {
    font-size: 1.1rem;
}

.publish-status {
    font-size: 0.8rem;
    color: var(--color-success);
    font-weight: 500;
}

/* Not Published State in Publisher */
.panel-not-published {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    color: #856404;
    text-align: center;
    padding: var(--space-sm);
}

.panel-not-published span {
    font-size: 2rem;
    margin-bottom: var(--space-xs);
}

.panel-not-published small {
    font-size: 0.7rem;
    font-weight: 600;
}

.panel-not-published .hint {
    font-weight: 400;
    opacity: 0.8;
    margin-top: 2px;
}

.preview-panel.not-published {
    border: 2px dashed #ffc107;
}

.polaroid-image-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #f5f5f5;
    border-radius: 2px;
    overflow: hidden;
    cursor: crosshair;
    user-select: none;
}

.polaroid-image-area.dragging {
    cursor: grabbing;
}

.polaroid-image-wrapper {
    width: 100%;
    height: 100%;
}

.polaroid-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    background: #fff;
}

.no-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.no-image-placeholder span {
    font-size: 3rem;
    opacity: 0.4;
}

.no-image-placeholder p {
    margin: var(--space-sm) 0;
}

.image-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--color-text-secondary);
}

/* Polaroid Caption */
.polaroid-caption-area {
    padding: var(--space-md) var(--space-sm);
    min-height: 60px;
}

.polaroid-caption-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: 'Comic Sans MS', 'Comic Neue', cursive;
    font-size: 1rem;
    text-align: center;
    color: var(--color-text);
    resize: none;
    outline: none;
}

.polaroid-caption-input:focus {
    background: #fafafa;
    border-radius: var(--radius-sm);
}

/* Caption Style Settings */
.caption-style-settings {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.caption-style-settings .style-row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.caption-style-settings .style-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    width: 50px;
    flex-shrink: 0;
}

.caption-style-settings .style-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: var(--color-border);
    border-radius: 2px;
    outline: none;
}

.caption-style-settings .style-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
}

.caption-style-settings .style-value {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    width: 35px;
    text-align: right;
    font-family: var(--font-mono);
}

.caption-style-settings .style-select {
    flex: 1;
    padding: 4px 8px;
    font-size: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.caption-style-settings .style-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.caption-hint {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-sm);
    padding: var(--space-xs);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

/* Live Caption Preview im Editor - wie Export aussehen */
.editor-caption-preview {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 14px;
    font-family: 'Caveat', 'Comic Neue', cursive;
    font-style: italic;
    line-height: 1.3;
    text-align: center;
    color: #333;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 15;
    border: none;
    cursor: move;
    user-select: none;
    white-space: pre-wrap;
    max-width: 80%;
    transition: box-shadow 0.15s ease;
}

.editor-caption-preview:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.editor-caption-preview:active {
    cursor: grabbing;
}

/* SVG Layer for Tails */
.bubble-tails-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Bubbles Overlay */
.bubbles-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

/* Speech Bubble */
.speech-bubble {
    position: absolute;
    transform: translate(-50%, -50%);
    background: white;
    padding: 8px 12px;
    border-radius: 16px;
    border: 2px solid #333;
    max-width: 180px;
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
    z-index: 10;
}

.speech-bubble:hover {
    box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.speech-bubble.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,165,181,0.3);
}

/* Bubble Types */
.speech-bubble.type-thought {
    border-radius: 50%;
    border-style: dotted;
}

.speech-bubble.type-shout {
    background: #fff3cd;
    border-color: #856404;
    border-radius: 8px;
    font-weight: bold;
}

.speech-bubble.type-narration {
    background: #f8f9fa;
    border: none;
    font-style: italic;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Font Sizes */
.speech-bubble.size-small {
    font-size: 0.75rem;
    padding: 6px 10px;
    max-width: 140px;
}

.speech-bubble.size-normal {
    font-size: 0.9rem;
}

.speech-bubble.size-large {
    font-size: 1.1rem;
    padding: 10px 14px;
    max-width: 220px;
}

/* Font Styles - matching caption font for consistency */
.speech-bubble.font-comic {
    font-family: 'Comic Neue', 'Comic Sans MS', cursive;
}

.speech-bubble.font-handwriting {
    font-family: 'Caveat', 'Segoe Script', cursive;
    font-style: italic;
}

.speech-bubble.font-bold {
    font-family: Impact, Haettenschweiler, sans-serif;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.speech-bubble.font-classic {
    font-family: Georgia, 'Times New Roman', serif;
}

/* Default font for bubbles - same as caption */
.speech-bubble {
    font-family: 'Caveat', 'Comic Neue', cursive;
}

/* Bubble Preview (while dragging) */
.bubble-preview {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 16px;
    border: 2px dashed var(--color-primary);
    max-width: 180px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    z-index: 20;
}

.bubble-preview.visible {
    opacity: 1;
}

.bubble-preview.type-thought {
    border-radius: 50%;
}

.bubble-preview.type-shout {
    background: rgba(255, 243, 205, 0.9);
    border-radius: 8px;
}

.bubble-preview.type-narration {
    background: rgba(248, 249, 250, 0.9);
    border-radius: 4px;
}

/* Drag Target Indicator */
.drag-target-indicator {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--color-accent);
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    z-index: 25;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.drag-target-indicator.visible {
    opacity: 1;
}

.drag-target-indicator::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: white;
    border-radius: 50%;
}

/* Drag Instructions */
.drag-instructions {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.instruction-step {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.step-num {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.7rem;
}

/* Editor Controls (Right Sidebar) */
.editor-controls {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    overflow-y: auto;
    border: 1px solid var(--color-border);
}

.controls-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.controls-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.controls-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

.selected-bubble-section {
    background: linear-gradient(135deg, rgba(0,165,181,0.05), rgba(0,165,181,0.1));
    margin: calc(-1 * var(--space-md));
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

/* Bubble Type Selector */
.bubble-type-selector {
    display: flex;
    gap: var(--space-xs);
}

.type-btn {
    flex: 1;
    padding: var(--space-sm);
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.type-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-border-light);
}

.type-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
}

/* Font Size Selector */
.font-size-selector {
    display: flex;
    gap: var(--space-xs);
}

.size-btn {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.size-btn:hover {
    border-color: var(--color-primary);
}

.size-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
    color: white;
}

/* Font Style Selector */
.font-style-selector {
    display: flex;
    gap: var(--space-xs);
}

.font-btn {
    flex: 1;
    padding: var(--space-sm);
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.font-btn:hover {
    border-color: var(--color-primary);
}

.font-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
    color: white;
}

/* Quick Dialogues */
.quick-dialogues {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 120px;
    overflow-y: auto;
}

.quick-dialogue-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-dialogue-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Bubble List */
.bubble-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.bubble-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-bg);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.bubble-list-item:hover {
    background: var(--color-border-light);
}

.bubble-list-item.selected {
    border-color: var(--color-primary);
    background: rgba(0,165,181,0.1);
}

.bubble-type-icon {
    font-size: 1rem;
}

.bubble-text-preview {
    flex: 1;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bubble-delete-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-error);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.bubble-list-item:hover .bubble-delete-btn {
    opacity: 1;
}

.bubble-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

/* Responsive Editor */
@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: 200px 1fr 240px;
    }
}

@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }
    
    .editor-sidebar {
        order: 1;
    }
    
    .editor-main-area {
        order: 2;
    }
    
    .editor-controls {
        order: 3;
    }
    
    .editor-panel-list {
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
    }
    
    .editor-panel-item {
        flex-shrink: 0;
        width: 80px;
        flex-direction: column;
        text-align: center;
    }
    
    .drag-instructions {
        flex-direction: column;
        gap: var(--space-sm);
    }
}

/* Caption Toggle */
.caption-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
}

/* ==========================================================================
   Publisher Bubbles (from Editor)
   ========================================================================== */

.panel-image {
    position: relative;
}

.publisher-bubbles-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.publisher-tails-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

.publisher-bubble {
    position: absolute;
    transform: translate(-50%, -50%);
    background: white;
    padding: 4px 8px;
    border-radius: 10px;
    border: 1.5px solid #333;
    max-width: 120px;
    text-align: center;
    font-size: 0.65rem;
    line-height: 1.2;
    box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
    z-index: 10;
}

/* Publisher Bubble Types */
.publisher-bubble.type-thought {
    border-radius: 50%;
    border-style: dotted;
}

.publisher-bubble.type-shout {
    background: #fff3cd;
    border-color: #856404;
    border-radius: 5px;
    font-weight: bold;
}

.publisher-bubble.type-narration {
    background: #f8f9fa;
    border: none;
    font-style: italic;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Publisher Bubble Sizes */
.publisher-bubble.size-small {
    font-size: 0.55rem;
    padding: 3px 6px;
    max-width: 90px;
}

.publisher-bubble.size-normal {
    font-size: 0.65rem;
}

.publisher-bubble.size-large {
    font-size: 0.75rem;
    padding: 5px 10px;
    max-width: 140px;
}

/* Publisher Bubble Fonts */
.publisher-bubble.font-comic {
    font-family: 'Comic Neue', 'Comic Sans MS', cursive;
}

.publisher-bubble.font-handwriting {
    font-family: 'Caveat', cursive;
}

.publisher-bubble.font-bold {
    font-family: Impact, Haettenschweiler, sans-serif;
    font-weight: 900;
    letter-spacing: 0.3px;
}

.publisher-bubble.font-classic {
    font-family: Georgia, serif;
}

/* Panel Caption - Aufgeklebtes Label-Style */
.panel-caption {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 14px;
    font-family: 'Caveat', 'Comic Neue', cursive;
    font-size: var(--caption-font-size, 14px);
    font-style: italic;
    line-height: 1.3;
    text-align: center;
    color: #333;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    border: none;
    transform: translate(-50%, -50%);
    white-space: pre-wrap;
    max-width: 80%;
}

/* Smaller captions in publisher preview thumbnails - scale proportionally */
.preview-panel .panel-caption {
    font-size: calc(var(--caption-font-size, 14px) * 0.35);
    padding: 2px 4px;
    border-radius: 2px;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Server API Key Notice */
.server-key-notice {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 0.85rem;
}

.server-key-notice.success {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.server-key-notice .notice-icon {
    font-size: 1rem;
}

.label-hint {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   Help View
   ========================================================================== */

.help-content {
    max-width: 900px;
    margin: 0 auto;
}

.help-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--color-border);
}

.help-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

/* Quick Start Steps */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.help-step {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content h4 {
    margin: 0 0 var(--space-xs) 0;
    font-size: 1rem;
    font-weight: 600;
}

.step-content p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Help Accordion */
.help-accordion {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.help-details {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.help-details summary {
    padding: var(--space-md);
    background: var(--color-bg);
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.help-details summary::-webkit-details-marker {
    display: none;
}

.help-details summary::before {
    content: '▶';
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.help-details[open] summary::before {
    transform: rotate(90deg);
}

.help-details[open] summary {
    border-bottom: 1px solid var(--color-border);
}

.details-content {
    padding: var(--space-md);
}

.details-content p {
    margin: 0 0 var(--space-sm) 0;
    color: var(--color-text-secondary);
}

.details-content ul {
    margin: var(--space-sm) 0;
    padding-left: var(--space-xl);
    list-style: disc outside !important;
}

.details-content ul li {
    margin-bottom: var(--space-xs);
    color: var(--color-text-secondary);
    display: list-item !important;
    list-style-type: disc !important;
}

.details-content ul li::marker {
    color: var(--color-primary);
}

/* Tips */
.help-tips {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.tip-item {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.tip-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.tip-item p {
    margin: 0;
    color: var(--color-text-secondary);
}

/* Keyboard Shortcuts */
.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-text-secondary);
}

.shortcut-item kbd {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* Info Modules */
.info-modules {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border-light);
}

.info-modules h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--color-text-secondary);
}

.module-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.module-badge {
    background: var(--color-primary);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Responsive Help */
@media (max-width: 600px) {
    .help-step {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .shortcut-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Image History Strip (Generator)
   ========================================================================== */

.image-count {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.image-history-strip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.strip-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.history-thumbnails {
    display: flex;
    gap: var(--space-xs);
    flex: 1;
    overflow-x: auto;
    padding: 2px;
}

.history-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.history-thumb:hover {
    border-color: var(--color-primary-light);
    transform: scale(1.05);
}

.history-thumb.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 165, 181, 0.3);
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.history-thumb .thumb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--color-border-light);
    font-size: 1rem;
}

.thumb-index {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-thumb.active .thumb-index {
    background: var(--color-primary);
}

/* Hidden file input */
.hidden-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Generator action buttons layout */
.generate-actions {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.generate-actions-secondary {
    display: flex;
    gap: var(--space-sm);
}

@media (max-width: 600px) {
    .generate-actions,
    .generate-actions-secondary {
        flex-direction: column;
    }
    
    .generate-actions .btn,
    .generate-actions-secondary .btn {
        width: 100%;
    }
}

/* ============================================================================
   Schreibtisch (Manuscript Editor)
   ============================================================================ */

.schreibtisch-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-lg);
    height: calc(100vh - 180px);
    min-height: 500px;
}

/* Sidebar */
.schreibtisch-sidebar {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.schreibtisch-sidebar .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.schreibtisch-sidebar .sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.manuscript-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.manuscript-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.manuscript-item:hover {
    background: var(--color-bg-hover);
}

.manuscript-item.active {
    border-color: var(--color-primary);
    background: rgba(0, 165, 181, 0.1);
}

.manuscript-item-content {
    flex: 1;
    min-width: 0;
}

.manuscript-title {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manuscript-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.manuscript-item-actions {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.manuscript-item:hover .manuscript-item-actions {
    opacity: 1;
}

/* Main Editor */
.schreibtisch-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.schreibtisch-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: var(--space-xl);
}

.schreibtisch-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

.schreibtisch-empty h3 {
    margin: 0 0 var(--space-sm);
    font-size: 1.5rem;
}

.schreibtisch-empty p {
    color: var(--color-text-muted);
    max-width: 400px;
    margin-bottom: var(--space-lg);
}

.schreibtisch-empty .empty-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    justify-content: center;
}

.schreibtisch-empty .empty-actions .btn {
    cursor: pointer;
}

/* Manuscript Editor */
.manuscript-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.manuscript-title-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.manuscript-title-input {
    flex: 1;
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--color-text);
    outline: none;
}

.manuscript-title-input::placeholder {
    color: var(--color-text-muted);
}

.manuscript-title-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.word-count {
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.save-status {
    color: var(--color-success);
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.toolbar-group {
    display: flex;
    gap: 2px;
}

.toolbar-right {
    margin-left: auto;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--color-text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.toolbar-btn:hover {
    background: var(--color-bg-hover);
}

.toolbar-btn:active {
    background: var(--color-primary);
    color: white;
}

/* Textarea Container */
.editor-container {
    flex: 1;
    display: flex;
    min-height: 0;
    padding: var(--space-md);
}

.manuscript-textarea {
    flex: 1;
    resize: none;
    border: none;
    background: var(--color-bg);
    color: var(--color-text);
    padding: var(--space-lg);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    border-radius: var(--radius-md);
    outline: none;
}

.manuscript-textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

.manuscript-textarea:focus {
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

/* Footer */
.manuscript-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.footer-info {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.footer-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Empty list state */
.empty-list {
    text-align: center;
    padding: var(--space-lg);
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 900px) {
    .schreibtisch-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .schreibtisch-sidebar {
        max-height: 200px;
    }
}

/* KI-Hint im Schreibtisch */
.ki-hint {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 165, 181, 0.1);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--color-text);
}

.ki-hint strong {
    color: var(--color-primary);
}

/* Generation Status Label */
.generation-status {
    display: inline-block;
    margin-left: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    animation: statusPulse 2s ease-in-out infinite;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Footer Info erweitern */
.manuscript-footer .footer-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

/* ============================================================
   Inline Controls (Zeile mit mehreren Controls)
   ============================================================ */

.inline-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.form-label-inline {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-right: var(--space-xs);
}

/* Size Number Input */
.size-number-input {
    width: 60px;
    padding: 4px 6px;
    font-size: 0.9rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    text-align: center;
    font-weight: 600;
}

.size-number-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.size-unit {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: -4px;
}

/* Compact Font Style Selector */
.font-style-selector.compact {
    display: flex;
    gap: 2px;
}

.font-style-selector.compact .font-btn {
    flex: none;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* Control Hint */
.control-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* Publisher Bubble with px fontSize */
.publisher-bubble {
    position: absolute;
    transform: translate(-50%, -50%);
    background: white;
    padding: 6px 10px;
    border-radius: 12px;
    border: 2px solid #333;
    max-width: 120px;
    text-align: center;
    z-index: 10;
    line-height: 1.2;
    font-family: 'Comic Sans MS', 'Comic Neue', cursive;
}

.publisher-bubble.type-thought {
    border-radius: 50%;
    padding: 8px 12px;
}

.publisher-bubble.type-shout {
    background: #fff3cd;
    border-radius: 4px;
    font-weight: bold;
}

.publisher-bubble.type-narration {
    background: rgba(255, 255, 220, 0.95);
    border: 1px solid #666;
    border-radius: 0;
}

.publisher-bubble.font-handwriting {
    font-family: 'Caveat', 'Segoe Script', cursive;
    font-style: italic;
}

.publisher-bubble.font-bold {
    font-family: Impact, sans-serif;
    font-weight: 900;
}

.publisher-bubble.font-classic {
    font-family: Georgia, serif;
}

/* Panel Caption mit px fontSize */
.panel-caption {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: 'Caveat', 'Comic Neue', cursive;
    font-style: italic;
    line-height: 1.3;
    text-align: center;
    color: #333;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: pre-wrap;
    max-width: 80%;
    z-index: 15;
}

/* ==========================================================================
   Position Table (Phase 51)
   ========================================================================== */

.position-table {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
}

.position-row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.position-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-weight: 600;
    min-width: 30px;
}

.position-current {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-surface);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.position-arrow {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.position-input {
    width: 45px;
    padding: 4px 6px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
}

.position-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.position-separator {
    color: var(--color-text-muted);
    font-weight: 600;
}

.btn-move {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-move:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

/* ==========================================================================
   Drag & Drop Panel Cards (Phase 51)
   ========================================================================== */

.storyboard-card-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.storyboard-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* Drop Indicator - Line between cards */
.drop-indicator {
    position: absolute;
    left: -8px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    border-radius: 2px;
    transition: all 0.15s ease;
    z-index: 10;
}

.drop-indicator::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    bottom: 0;
    width: 16px;
    /* Invisible hit area */
}

.drop-indicator.active {
    background: var(--color-primary);
    box-shadow: 0 0 8px rgba(0, 165, 181, 0.5);
}

.drop-indicator.active::after {
    content: '';
    position: absolute;
    left: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
}

/* Drop indicator at the end (after last card) */
.drop-indicator-end {
    position: relative;
    left: auto;
    right: -8px;
    width: 4px;
    min-height: 100px;
    margin-left: auto;
}

/* Adjust grid for wrapper */
.storyboard-grid {
    position: relative;
}

.storyboard-card-wrapper {
    position: relative;
}

/* Visual feedback when dragging over grid */
.storyboard-grid.drag-active {
    background: rgba(0, 165, 181, 0.05);
    border-radius: var(--radius-lg);
}

/* Image Fit Preview in Settings */
.image-fit-preview {
    margin-top: var(--space-md);
}

.fit-example {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.fit-box {
    text-align: center;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.fit-box.active {
    opacity: 1;
}

.fit-box span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.fit-image {
    width: 80px;
    height: 60px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    position: relative;
    background: #fff;
}

.fit-box.active .fit-image {
    border-color: var(--color-primary);
}

.fit-image::before {
    content: '';
    position: absolute;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
}

.fit-image.contain::before {
    /* Landscape Bild in Portrait-Box */
    width: 100%;
    height: 40px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.fit-image.cover::before {
    /* Landscape Bild füllt Box, Seiten abgeschnitten */
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* --------------------------------------------------------------------------
   Hamburger Menu
   -------------------------------------------------------------------------- */
.hamburger-menu-container {
    position: relative;
}

.btn-hamburger {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-hamburger:hover {
    background: var(--color-bg);
    border-color: var(--color-border);
}

.btn-hamburger.active {
    background: var(--color-surface-elevated);
    border-color: var(--color-primary);
}

.hamburger-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}

/* Transitions */
.transition-enter {
    transition: all 0.2s ease-out;
}

.transition-enter-start {
    opacity: 0;
    transform: translateY(-8px);
}

.transition-enter-end {
    opacity: 1;
    transform: translateY(0);
}

.transition-leave {
    transition: all 0.15s ease-in;
}

.transition-leave-start {
    opacity: 1;
    transform: translateY(0);
}

.transition-leave-end {
    opacity: 0;
    transform: translateY(-8px);
}

.hamburger-section {
    padding: var(--space-sm);
}

.hamburger-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-xs);
}

.hamburger-divider {
    height: 1px;
    background: var(--color-border);
    margin: 0;
}

.hamburger-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.9375rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hamburger-item:hover {
    background: var(--color-bg);
}

.hamburger-item-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.hamburger-item-active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.hamburger-item-danger {
    color: var(--color-danger);
}

.hamburger-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* User Info Section */
.hamburger-user-info {
    display: flex;
    flex-direction: column;
}

.hamburger-user-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-xs) var(--space-md);
    margin-bottom: var(--space-xs);
}

.hamburger-user-email {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.hamburger-user-status {
    font-size: 0.75rem;
    color: var(--color-success);
}

/* Dark Mode Toggle */
.hamburger-item-toggle {
    justify-content: flex-start;
}

.hamburger-toggle-indicator {
    margin-left: auto;
    width: 36px;
    height: 20px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    position: relative;
    transition: all var(--transition-fast);
}

.hamburger-toggle-indicator::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.hamburger-toggle-indicator.active {
    background: var(--color-primary);
}

.hamburger-toggle-indicator.active::after {
    left: 18px;
}
