/* ============================================================
   Canvas Editor Layout - ShowStudio-inspired Minimal Design
   ============================================================ */

.editor-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width, 260px) 1fr var(--properties-width, 280px);
    grid-template-rows: var(--toolbar-height, 52px) 1fr;
    grid-template-areas:
        "toolbar toolbar toolbar"
        "library canvas properties";
    height: 100vh;
    overflow: hidden;
    background: var(--color-bg);
}

/* Toolbar - ShowStudio style */
.editor-toolbar {
    grid-area: toolbar;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    padding: 0 var(--space-md);
    gap: var(--space-sm);
    z-index: 20;
}

.toolbar-logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text);
    margin-right: var(--space-md);
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.toolbar-logo span {
    display: block;
    font-size: 0.5rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-top: 1px;
}

.project-title-display {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px 8px;
    border: 1px solid transparent;
    cursor: default;
    transition: all var(--transition-fast);
}

.project-title-display:hover {
    border-color: var(--color-border-light);
    background: var(--color-bg-secondary);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--color-border-light);
    margin: 0 var(--space-xs);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 1px;
}

.toolbar-spacer {
    flex: 1;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1rem;
    transition: all var(--transition-fast);
    position: relative;
}

.toolbar-btn:hover {
    border-color: var(--color-border-light);
    color: var(--color-text);
}

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

.toolbar-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.toolbar-btn[title]::after {
    content: attr(title);
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: var(--color-bg);
    padding: 4px 10px;
    font-size: 0.6rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 100;
}

.toolbar-btn:hover[title]::after {
    opacity: 1;
}

/* Library Panel - ShowStudio style */
.library-panel {
    grid-area: library;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.library-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.library-header h3 {
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-sm);
    color: var(--color-text-muted);
}

.library-search {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 300;
    border: 1px solid var(--color-border);
    outline: none;
    background: var(--color-bg);
    transition: border-color var(--transition-fast);
}

.library-search:focus {
    border-color: var(--color-text);
}

.library-search::placeholder {
    color: var(--color-text-light);
}

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

/* Category accordion - ShowStudio style */
.library-category {
    margin-bottom: 1px;
    border: 1px solid var(--color-border-light);
}

.library-category-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text);
    user-select: none;
    transition: background var(--transition-fast);
}

.library-category-header:hover {
    background: var(--color-bg-secondary);
}

.library-category-header .arrow {
    font-size: 0.6rem;
    transition: transform var(--transition-fast);
    color: var(--color-text-muted);
}

.library-category.open .arrow {
    transform: rotate(90deg);
}

.library-category-count {
    margin-left: auto;
    font-size: 0.6rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

.library-category-items {
    display: none;
    padding: var(--space-xs);
    border-top: 1px solid var(--color-border-light);
    background: var(--color-bg-secondary);
}

.library-category.open .library-category-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
}

/* Library item (draggable) - ShowStudio style */
.library-item {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: grab;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    transition: all var(--transition-fast);
    position: relative;
}

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

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

.library-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    pointer-events: none;
}

.library-item .library-item-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 0.55rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Library Sections */
.library-section {
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: var(--space-md);
}

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

.library-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-xs);
    margin-bottom: var(--space-sm);
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.library-header-actions {
    display: flex;
    gap: 4px;
}

.library-upload-btn {
    padding: 6px 12px !important;
    font-size: 0.6rem !important;
}

.library-folder-btn {
    padding: 6px 10px !important;
    font-size: 0.55rem !important;
}

.library-subsection {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px dashed var(--color-border-light);
}

.library-subsection-title {
    font-size: 0.6rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    padding: var(--space-xs);
}

.library-empty-hint {
    padding: var(--space-md);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--color-text-muted);
}

/* Folder UI - ShowStudio style */
.library-folder {
    margin-bottom: 1px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
}

.library-folder-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--color-text);
    transition: background var(--transition-fast);
}

.library-folder-header:hover {
    background: var(--color-border-light);
}

.folder-toggle-icon {
    font-size: 0.55rem;
    color: var(--color-text-muted);
    width: 12px;
    text-align: center;
}

.folder-preview-thumb {
    width: 24px;
    height: 24px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--color-border-light);
}

.folder-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
}

.folder-count {
    font-size: 0.6rem;
    color: var(--color-text-muted);
    background: var(--color-surface);
    padding: 2px 8px;
    border: 1px solid var(--color-border-light);
}

.folder-upload-btn {
    width: 20px;
    height: 20px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.folder-upload-btn:hover {
    border-color: var(--color-text);
    color: var(--color-text);
}

.library-folder-header:hover .folder-upload-btn,
.library-folder-header:hover .folder-delete-btn {
    opacity: 1;
}

.folder-delete-btn {
    width: 20px;
    height: 20px;
    border: 1px solid var(--color-danger);
    background: transparent;
    color: var(--color-danger);
    font-size: 0.65rem;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 2px;
}

.folder-delete-btn:hover {
    background: var(--color-danger);
    color: white;
}

.library-folder-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm) var(--space-sm);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border-light);
}

.library-folder-add {
    aspect-ratio: 1;
    border: 1px dashed var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.6rem;
    color: var(--color-text-muted);
}

.library-folder-add:hover {
    border-color: var(--color-text);
    border-style: solid;
    color: var(--color-text);
}

/* Canvas Area */
.canvas-area {
    grid-area: canvas;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #f0ebe6;
    background-image:
        linear-gradient(45deg, #e8e4df 25%, transparent 25%),
        linear-gradient(-45deg, #e8e4df 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e8e4df 75%),
        linear-gradient(-45deg, transparent 75%, #e8e4df 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.canvas-wrapper {
    position: relative;
    border: 1px solid var(--color-border-light);
}

.canvas-wrapper canvas {
    display: block;
}

/* Properties Panel - ShowStudio style */
.properties-panel {
    grid-area: properties;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.properties-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.properties-header h3 {
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

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

.properties-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--space-2xl) var(--space-md);
    font-size: 0.8rem;
    font-weight: 300;
}

/* Property group - ShowStudio style */
.prop-group {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.prop-group:last-child {
    border-bottom: none;
}

.prop-group-title {
    font-size: 0.6rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.prop-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.prop-label {
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--color-text-muted);
    width: 28px;
    flex-shrink: 0;
}

.prop-input {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 300;
    border: 1px solid var(--color-border);
    outline: none;
    background: var(--color-bg);
    font-family: var(--font-body);
}

.prop-input:focus {
    border-color: var(--color-text);
}

/* Range slider - ShowStudio style */
.prop-range {
    flex: 1;
    -webkit-appearance: none;
    height: 2px;
    background: var(--color-border);
    outline: none;
}

.prop-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--color-text);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.prop-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.prop-range-value {
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--color-text-muted);
    width: 36px;
    text-align: right;
}

/* Toggle button group - ShowStudio style */
.prop-toggles {
    display: flex;
    gap: 0;
}

.prop-toggle {
    flex: 1;
    padding: 8px;
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--color-border);
    border-right: none;
    background: var(--color-bg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.prop-toggle:last-child {
    border-right: 1px solid var(--color-border);
}

.prop-toggle:hover {
    background: var(--color-bg-secondary);
}

.prop-toggle.active {
    background: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-bg);
}

/* Property action buttons */
.prop-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.prop-actions-4 {
    grid-template-columns: repeat(4, 1fr);
}

.prop-action-btn {
    padding: 8px 6px;
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    white-space: nowrap;
}

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

.prop-action-btn-sm {
    padding: 6px 4px;
    font-size: 0.75rem;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.prop-action-btn-sm:hover {
    border-color: var(--color-text);
    background: var(--color-text);
    color: var(--color-bg);
}

/* ============================================================
   Fullscreen Mode
   ============================================================ */
.editor-layout.fullscreen-mode {
    grid-template-columns: 0 1fr 0;
}

.editor-layout.fullscreen-mode .editor-toolbar {
    display: none;
}

.editor-layout.fullscreen-mode .library-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}

.editor-layout.fullscreen-mode .library-panel:hover,
.editor-layout.fullscreen-mode .library-panel.peek {
    transform: translateX(0);
}

.editor-layout.fullscreen-mode .properties-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.editor-layout.fullscreen-mode .properties-panel:hover,
.editor-layout.fullscreen-mode .properties-panel.peek {
    transform: translateX(0);
}

/* Hover trigger zones */
.fullscreen-hover-left,
.fullscreen-hover-right {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 20px;
    z-index: 45;
    display: none;
}

.editor-layout.fullscreen-mode ~ .fullscreen-hover-left,
.editor-layout.fullscreen-mode ~ .fullscreen-hover-right {
    display: block;
}

.fullscreen-hover-left {
    left: 0;
}

.fullscreen-hover-right {
    right: 0;
}

/* Fullscreen exit hint */
.fullscreen-exit-hint {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 16px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 55;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    display: none;
}

.editor-layout.fullscreen-mode ~ .fullscreen-exit-hint {
    display: block;
    animation: hint-fade 3s ease forwards;
}

@keyframes hint-fade {
    0% { opacity: 0; }
    10% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Canvas zoom indicator */
.canvas-zoom-indicator {
    position: absolute;
    bottom: var(--space-md);
    right: var(--space-md);
    background: var(--color-text);
    color: var(--color-bg);
    padding: 6px 12px;
    font-size: 0.6rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
    z-index: 5;
}

/* ============================================================
   Crop & Lasso Tools - ShowStudio style
   ============================================================ */

.crop-tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.crop-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px !important;
    height: auto !important;
}

.crop-tool-btn .crop-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.crop-tool-btn span:last-child {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Crop confirm panel */
.crop-confirm-panel {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.crop-confirm-label {
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--color-text-secondary);
}

/* Lasso tool confirm overlay */
.tool-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.tool-confirm-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: var(--space-xl);
    text-align: center;
    max-width: 320px;
}

.tool-confirm-panel h4 {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.tool-confirm-panel p {
    margin: 0 0 16px 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 300;
}

.tool-confirm-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Mobile toggle buttons */
.mobile-panel-toggle {
    display: none;
    position: fixed;
    z-index: 30;
    width: 44px;
    height: 44px;
    background: var(--color-text);
    color: var(--color-bg);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

#toggle-library {
    bottom: var(--space-lg);
    left: var(--space-lg);
}

#toggle-properties {
    bottom: var(--space-lg);
    right: var(--space-lg);
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: var(--toolbar-height, 52px) 1fr;
        grid-template-areas:
            "toolbar"
            "canvas";
    }

    .library-panel {
        position: fixed;
        top: 52px;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 25;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .library-panel.open {
        transform: translateX(0);
    }

    .properties-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 45vh;
        z-index: 25;
        transform: translateY(100%);
        transition: transform var(--transition-normal);
        border-top: 1px solid var(--color-border-light);
    }

    .properties-panel.open {
        transform: translateY(0);
    }

    .mobile-panel-toggle {
        display: flex;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .editor-toolbar {
        padding: 0 var(--space-sm);
        gap: 2px;
    }

    .toolbar-logo {
        font-size: 0.8rem;
        margin-right: var(--space-sm);
    }

    .toolbar-logo span {
        display: none;
    }

    .toolbar-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .library-panel {
        width: 100%;
    }

    .properties-panel {
        height: 55vh;
    }

    .library-category.open .library-category-items {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================================
   Library Asset Preview on Hover
   ============================================================ */
.library-preview {
    position: fixed;
    z-index: 9999;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    padding: var(--space-sm);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease, transform 0.15s ease;
    max-width: 280px;
}

.library-preview.visible {
    opacity: 1;
    transform: scale(1);
}

.library-preview-img {
    display: block;
    max-width: 260px;
    max-height: 260px;
    width: auto;
    height: auto;
    object-fit: contain;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.library-preview-title {
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--color-text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   AI Assistant Modal
   ============================================================ */
.ai-assistant-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-assistant-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.ai-assistant-container {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.ai-assistant-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.ai-assistant-close {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.ai-assistant-close:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.ai-assistant-progress {
    display: flex;
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-xs);
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg);
}

.progress-step {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    text-align: center;
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.progress-step.active {
    background: var(--color-primary);
    color: white;
}

.progress-step.completed {
    background: var(--color-success);
    color: white;
}

.ai-assistant-content {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    min-height: 300px;
}

.ai-assistant-footer {
    display: flex;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.ai-assistant-footer-spacer {
    flex: 1;
}

/* AI Loading */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    text-align: center;
}

.ai-loading .spinner {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-lg);
}

/* AI Response */
.ai-response {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.ai-image-preview {
    text-align: center;
}

.ai-image-preview img {
    max-width: 300px;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.ai-text {
    line-height: 1.7;
}

.ai-text h2, .ai-text h3, .ai-text h4 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--color-primary);
}

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

.ai-text ul, .ai-text ol {
    margin: var(--space-sm) 0;
    padding-left: var(--space-lg);
}

.ai-text li {
    margin-bottom: var(--space-xs);
}

/* AI Error */
.ai-error {
    text-align: center;
    padding: var(--space-3xl);
}

.ai-error p:first-child {
    font-size: 1.2rem;
    margin-bottom: var(--space-sm);
}

/* AI Reflection */
.ai-reflection h3 {
    margin-bottom: var(--space-md);
}

.ai-questions {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

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

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

.ai-question-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
    padding-top: 4px;
}

.ai-question-answer {
    width: 100%;
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}

/* AI Exercise */
.ai-exercise h3, .ai-body h3, .ai-integration h3 {
    margin-bottom: var(--space-md);
}

.ai-exercise-content, .ai-body-content {
    background: var(--color-bg);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    line-height: 1.7;
}

.ai-exercise-note, .ai-body-timer {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(var(--color-primary-rgb, 91, 123, 154), 0.1);
    border-radius: var(--radius-sm);
}

.ai-body-timer {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

#ai-timer-display {
    font-size: 1.5rem;
    font-weight: 600;
    font-family: monospace;
}

/* AI Integration */
.ai-integration-questions {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin: var(--space-lg) 0;
}

.ai-integration-item label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.ai-integration-item textarea {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    resize: vertical;
}

.ai-integration-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

/* AI Split Layout - artwork vlevo, text vpravo */
.ai-layout-split {
    max-width: 1100px;
}

.ai-assistant-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.ai-assistant-sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: var(--space-md);
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.ai-artwork-container {
    position: sticky;
    top: var(--space-md);
}

.ai-artwork-container img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* === "Ukazuj" Zone Overlay === */
.ai-zone-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    pointer-events: none;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ai-zone-overlay.disabled {
    display: none;
}

.ai-zone {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.ai-zone.active {
    background-color: rgba(255, 220, 100, 0.4);
    box-shadow: inset 0 0 0 3px rgba(255, 180, 0, 0.8);
    animation: zone-pulse 1s ease-in-out infinite;
}

@keyframes zone-pulse {
    0%, 100% { background-color: rgba(255, 220, 100, 0.3); }
    50% { background-color: rgba(255, 220, 100, 0.5); }
}

/* Grid pozice zón */
.ai-zone[data-zone="top-left"] { grid-area: 1 / 1 / 2 / 2; }
.ai-zone[data-zone="top-center"] { grid-area: 1 / 2 / 2 / 3; }
.ai-zone[data-zone="top-right"] { grid-area: 1 / 3 / 2 / 4; }
.ai-zone[data-zone="center-left"] { grid-area: 2 / 1 / 3 / 2; }
.ai-zone[data-zone="center"] { grid-area: 2 / 2 / 3 / 3; }
.ai-zone[data-zone="center-right"] { grid-area: 2 / 3 / 3 / 4; }
.ai-zone[data-zone="bottom-left"] { grid-area: 3 / 1 / 4 / 2; }
.ai-zone[data-zone="bottom-center"] { grid-area: 3 / 2 / 4 / 3; }
.ai-zone[data-zone="bottom-right"] { grid-area: 3 / 3 / 4 / 4; }

/* Zone marker v textu */
.ai-zone-marker {
    display: inline-block;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #6b4800;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    cursor: pointer;
    margin: 0 2px;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.ai-zone-marker:hover {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    transform: scale(1.1);
}

/* Toggle pro Ukazuj */
.ai-show-toggle {
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.ai-show-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.ai-show-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* Artwork container - musí být relative pro overlay */
.ai-artwork-container {
    position: relative;
    top: 0;
}

.ai-assistant-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.ai-assistant-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
}

.ai-assistant-footer-spacer {
    flex: 1;
}

/* Intro dialog */
.ai-intro {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
}

.ai-intro h3 {
    margin-bottom: var(--space-sm);
}

.ai-user-note {
    width: 100%;
    max-width: 500px;
    margin: var(--space-lg) auto;
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
}

.ai-intro .btn-lg {
    margin-top: var(--space-md);
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
}

/* Progress step 0 (Úvod) */
.progress-step[data-step="0"] .step-number {
    font-size: 0.6rem;
}

/* AI Complete */
.ai-complete {
    text-align: center;
    padding: var(--space-xl);
}

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

.ai-complete h3 {
    margin-bottom: var(--space-sm);
}

.ai-complete-summary {
    background: var(--color-bg);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin: var(--space-lg) auto;
    max-width: 300px;
    text-align: left;
}

.ai-complete-summary p {
    margin: var(--space-xs) 0;
}

.ai-complete-note {
    background: rgba(var(--color-primary-rgb, 91, 123, 154), 0.1);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    margin: var(--space-lg) 0;
    text-align: left;
}

/* Theme Selection */
.ai-theme-selection {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.ai-theme-selection h4 {
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

.ai-theme-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.ai-theme-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.ai-theme-option:hover {
    background: var(--color-bg-hover);
}

.ai-theme-option input[type="radio"] {
    accent-color: var(--color-primary);
}

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

.ai-theme-custom {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-left: var(--space-sm);
}

/* Reflection Header */
.ai-reflection-header {
    margin-bottom: var(--space-lg);
}

.ai-reflection-header h3 {
    margin-bottom: var(--space-xs);
}

/* Question Content */
.ai-question-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Grounding */
.ai-grounding {
    padding: var(--space-md);
}

.ai-grounding h3 {
    margin-bottom: var(--space-xs);
}

.ai-grounding-content {
    background: var(--color-bg);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin: var(--space-lg) 0;
    line-height: 1.8;
}

.ai-grounding-timer {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    justify-content: center;
    margin-top: var(--space-lg);
}

.ai-timer-display {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
}

/* AI Checkbox */
.ai-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    cursor: pointer;
}

.ai-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* Progress Step with numbers */
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s;
}

.progress-step.active .step-number {
    background: var(--color-primary);
    color: white;
}

.progress-step.completed .step-number {
    background: var(--color-success, #28a745);
    color: white;
}

.progress-step.completed .step-number::after {
    content: "✓";
}

.step-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.progress-step.active .step-label {
    opacity: 1;
    font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
    .ai-assistant-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .ai-assistant-body {
        flex-direction: column;
    }

    .ai-assistant-sidebar {
        width: 100%;
        max-height: 150px;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: var(--space-sm);
    }

    .ai-artwork-container {
        display: flex;
        justify-content: center;
    }

    .ai-artwork-container img {
        max-height: 120px;
        width: auto;
    }

    .ai-assistant-progress {
        flex-wrap: wrap;
    }

    .progress-step {
        font-size: 0.65rem;
        padding: var(--space-xs);
    }

    .ai-question-item {
        flex-direction: column;
    }

    .ai-question-number {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    .ai-theme-options {
        gap: var(--space-xs);
    }

    .ai-theme-option {
        padding: var(--space-xs) var(--space-sm);
    }

    .ai-grounding-timer {
        flex-direction: column;
    }

    .ai-intro {
        padding: var(--space-md);
    }

    .ai-user-note {
        max-width: 100%;
    }
}
