/* ===== RESET & GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c2c2c;
    --primary-dark: #1a1a1a;
    --secondary: #4a4a4a;
    --accent: #000000;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    --bg-main: #f8f8f8;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-light: #ffffff;
    --border-light: #e5e5e5;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    background-attachment: fixed;
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ===== LOADING OVERLAY ===== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-light);
}

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    background: white;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    max-width: 280px;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }

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

/* ===== INITIAL STATE ===== */
#initial-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.welcome-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 48px;
    max-width: 900px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.welcome-card h1 {
    font-size: 42px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 48px;
}

.initial-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    margin-top: 32px;
}

.action-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 32px;
}

.action-row .action-card {
    grid-column: span 4;
    height: 100%;
}

.action-row .action-card-wide {
    grid-column: span 8;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 32px;
    transition: all 0.2s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-card .icon {
    font-size: 32px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.action-card h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.action-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    background: var(--bg-card);
    color: var(--text-primary);
}

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

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}

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

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

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

.btn-accent {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-accent:hover {
    background: var(--bg-main);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-block {
    width: 100%;
    margin-bottom: 12px;
}

/* ===== INPUTS ===== */
.prompt-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.15s ease;
}

.prompt-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(44, 44, 44, 0.1);
}

.prompt-input::placeholder {
    color: var(--text-secondary);
}

/* ===== EDITOR STATE ===== */
#editor-state {
    position: relative;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header {
    margin-bottom: 15px;
}

.sidebar-header h3 {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Version List */
.version-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.version-item {
    width: 120px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-light);
    transition: all 0.15s ease;
    position: relative;
}

.version-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.version-item.active {
    border-color: var(--primary);
}

.version-item .version-number {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Info Section */
.info-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.info-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

/* ===== CANVAS ===== */
.canvas-wrapper {
    width: 100%;
    height: calc(100vh - 120px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20px;
    position: relative;
    z-index: 1;
}

#main-canvas {
    max-width: calc(100vw - 100px);
    max-height: calc(100vh - 180px);
    border-radius: 4px;
    background: white;
    box-shadow: var(--shadow-md);
    cursor: crosshair;
}

/* Text Boxes (Overlay on Canvas) */
.text-box {
    position: absolute;
    background: rgba(255, 248, 230, 0.95);
    border: 2px solid #d4d4d4;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    color: #000000;
    font-weight: 500;
    cursor: move;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 80px;
    min-height: 30px;
    white-space: nowrap;
    z-index: 100;
    resize: none;
    overflow: hidden;
}

.text-box:hover {
    border-color: #999;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.text-box.dragging {
    opacity: 0.8;
    cursor: grabbing;
}

.text-box-controls {
    position: absolute;
    top: -24px;
    right: 0;
    display: none;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    padding: 2px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.text-box:hover .text-box-controls {
    display: flex;
}

.text-box-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    color: #666;
}

.text-box-btn:hover {
    background: #f0f0f0;
    color: #000;
}

/* ===== TOOLBAR - SINGLE ROW ===== */
.toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-float);
    z-index: 200;
    height: 80px;
    width: 92%;
    max-width: 1400px;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 8px;
    border-right: 1px solid var(--border-light);
}

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

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

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

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 6px;
    border-left: 1px solid var(--border-light);
}

#color-picker {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

#brush-size {
    width: 50px;
}

/* Version Mini */
.version-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    margin-right: 8px;
    border-right: 1px solid var(--border-light);
    min-height: 56px;
}

/* Reset Button (Separated) */
.reset-btn-separate {
    width: 32px;
    height: 32px;
    padding: 0;
    margin-right: 16px;
    padding-right: 16px;
    border-right: 1px solid var(--border-light);
    background: transparent;
}

.version-list-mini {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 50px;
}

.version-list-mini .version-item {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-light);
    flex-shrink: 0;
    background: white;
    transition: all 0.15s ease;
}

.version-list-mini .version-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.version-list-mini .version-item:hover {
    border-color: var(--secondary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.version-list-mini .version-item.active {
    border-color: var(--primary);
    border-width: 3px;
    box-shadow: 0 0 0 1px var(--primary);
}

/* Compact Textarea Prompt */
.prompt-textarea-compact {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    min-width: 350px;
    height: 56px;
    resize: none;
    line-height: 1.3;
}

.prompt-textarea-compact:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(44, 44, 44, 0.1);
}

.prompt-textarea-compact::placeholder {
    color: var(--text-secondary);
}

/* Enhance Prompt Button */
.enhance-prompt-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    opacity: 0.4;
    transition: all 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enhance-prompt-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

.enhance-prompt-btn:active {
    transform: translateY(-50%) scale(0.95);
}

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

.enhance-prompt-btn svg {
    color: var(--text-secondary);
}

.enhance-prompt-btn.spinning svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Reference Drop Zone Mini */
.reference-dropzone-mini {
    width: 60px;
    height: 40px;
    border: 1.5px dashed var(--border-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    background: var(--bg-main);
}

.reference-dropzone-mini:hover,
.reference-dropzone-mini.dragover {
    border-color: var(--secondary);
}

.reference-dropzone-mini.has-image {
    border-style: solid;
    border-color: var(--primary);
}

.reference-dropzone-mini .dropzone-content {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.reference-dropzone-mini .dropzone-content svg {
    width: 20px;
    height: 20px;
    opacity: 0.5;
}

.reference-dropzone-mini .reference-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Pro Model Toggle */
.pro-model-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0 6px;
}

.pro-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    accent-color: #667eea;
}

.pro-label {
    font-size: 8px;
    font-weight: 600;
    color: #666;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}

/* Special Actions */
.special-actions {
    display: flex;
    gap: 6px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid var(--border-light);
}

/* ===== TEXT MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 8px;
    min-width: 360px;
    box-shadow: var(--shadow-xl);
}

.modal-content h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 16px;
    font-weight: 500;
}

.modal-content input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-content input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(44, 44, 44, 0.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    #editor-state {
        grid-template-columns: 160px 1fr 160px;
    }

    .sidebar {
        padding: 12px;
    }

    .prompt-group {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .welcome-card {
        padding: 32px 24px;
    }

    .welcome-card h1 {
        font-size: 36px;
    }

    .initial-actions {
        grid-template-columns: 1fr;
    }

    .action-row {
        grid-template-columns: 1fr;
    }

    .action-row .action-card,
    .action-row .action-card-wide {
        grid-column: 1 / -1;
    }

    #editor-state {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto auto;
    }

    .sidebar {
        max-height: 150px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .sidebar-left {
        order: 3;
    }

    .canvas-container {
        order: 1;
    }

    .sidebar-right {
        order: 4;
    }

    .version-list {
        flex-direction: row;
        margin-bottom: 0;
    }

    .version-item {
        min-width: 80px;
        height: 80px;
    }

    .toolbar {
        justify-content: center;
    }

    .prompt-group {
        width: 100%;
        min-width: auto;
    }

    .modal-content {
        min-width: auto;
        width: 90%;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .welcome-card {
        padding: 24px 16px;
    }

    .welcome-card h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 16px;
    }

    .action-card {
        padding: 24px;
    }

    .toolbar {
        padding: 12px;
        gap: 8px;
    }

    .tool-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    #color-picker {
        width: 32px;
        height: 32px;
    }

    #brush-size {
        width: 60px;
    }
}

/* ===== LLM FEEDBACK FEATURE START ===== */

/* Floating Chat Button */
.llm-chat-button {
    position: fixed;
    bottom: 120px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 500;
    color: white;
}

.llm-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.5);
}

.llm-chat-button:active {
    transform: scale(0.95);
}

.llm-chat-button svg {
    flex-shrink: 0;
}

/* Chat Panel */
.llm-chat-panel {
    position: fixed;
    left: 30px;
    bottom: 200px;
    width: 360px;
    max-height: 600px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 499;
    overflow: hidden;
    transform-origin: bottom left;
    animation: slideUpFade 0.3s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.llm-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    color: white;
}

.llm-chat-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.llm-chat-controls {
    display: flex;
    gap: 8px;
}

.llm-control-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    color: white;
    padding: 0;
}

.llm-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.llm-control-btn svg {
    flex-shrink: 0;
}

/* Chat Body */
.llm-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 200px;
    max-height: 300px;
}

.llm-response-area {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.llm-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.llm-response-area h1,
.llm-response-area h2,
.llm-response-area h3 {
    margin: 12px 0 8px;
    font-weight: 600;
}

.llm-response-area h1 { font-size: 18px; }
.llm-response-area h2 { font-size: 16px; }
.llm-response-area h3 { font-size: 14px; }

.llm-response-area p {
    margin: 8px 0;
}

.llm-response-area ul,
.llm-response-area ol {
    margin: 8px 0;
    padding-left: 20px;
}

.llm-response-area li {
    margin: 4px 0;
}

.llm-response-area code {
    background: var(--bg-main);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.llm-response-area pre {
    background: var(--bg-main);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.llm-response-area a {
    color: #9333EA;
    text-decoration: none;
}

.llm-response-area a:hover {
    text-decoration: underline;
}

/* Chat Footer */
.llm-chat-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

.llm-preset-btn {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.15s ease;
    color: var(--text-primary);
}

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

.llm-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    margin-bottom: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.llm-input:focus {
    outline: none;
    border-color: #9333EA;
    box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.1);
}

.llm-input::placeholder {
    color: var(--text-secondary);
}

.llm-send-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.llm-char-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.llm-send-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.llm-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.llm-send-btn:active {
    transform: translateY(0);
}

.llm-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.llm-send-icon {
    flex-shrink: 0;
}

/* Processing Overlay */
.llm-processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

.llm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(147, 51, 234, 0.2);
    border-top-color: #9333EA;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.llm-processing-overlay p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* LLM Annotations on Canvas */
.llm-annotation {
    position: absolute;
    pointer-events: none;
    z-index: 150;
    transform: translate(-50%, -50%);
}

.llm-annotation-dot {
    width: 14px;
    height: 14px;
    background: #9333EA;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: llmPulse 2s ease-in-out infinite;
}

@keyframes llmPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 2px 12px rgba(147, 51, 234, 0.6);
    }
}

.llm-annotation-label {
    position: absolute;
    background: rgba(147, 51, 234, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 250px;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    cursor: default;
    z-index: 999;
    border: 2px solid white;
}

.llm-annotation-label::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .llm-chat-panel {
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
        max-width: 360px;
        bottom: 180px;
    }

    .llm-chat-button {
        left: 20px;
        bottom: 110px;
        width: 56px;
        height: 56px;
    }

    .llm-chat-body {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .llm-chat-panel {
        max-height: 500px;
    }

    .llm-chat-body {
        max-height: 200px;
    }

    .llm-annotation-label {
        max-width: 150px;
        font-size: 11px;
    }
}

/* ===== LLM FEEDBACK FEATURE END ===== */

/* ===== NEW PROJECT MODAL STYLES ===== */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.preset-btn {
    background: var(--bg-main);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.preset-btn:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: var(--shadow-md);
}

.preset-btn span {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.preset-btn span.dim {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.aspect-ratio {
    background: #e0e0e0;
    border: 1px dashed #999;
    margin-bottom: 8px;
}

.aspect-ratio.square { width: 40px; height: 40px; }
.aspect-ratio.landscape { width: 56px; height: 32px; }
.aspect-ratio.portrait { width: 32px; height: 56px; }
.aspect-ratio.wide { width: 64px; height: 28px; }

/* ===== CHECKBOX STYLES ===== */
.checkbox-container {
    display: block;
    position: relative;
    cursor: pointer;
    user-select: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.checkbox-container:hover {
    background: var(--bg-main);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-container:hover .checkmark {
    color: var(--text-primary);
}

.checkbox-container input:checked ~ .checkmark {
    color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark svg {
    fill: rgba(44, 44, 44, 0.1);
}

/* ===== ICON BUTTON ===== */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ===== MODEL VIEWER ===== */
model-viewer {
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
    --poster-color: transparent;
}

/* ===== PROMPT TEMPLATE PILLS ===== */
.prompt-pills-container {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    z-index: 150;
    max-width: 90%;
    overflow-x: auto;
}

.pill-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    white-space: nowrap;
}

.pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f0f0f0;
    border: 2px solid #d0d0d0;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    opacity: 0.6;
}

.pill:hover {
    opacity: 1;
    border-color: var(--secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.pill.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
    opacity: 1;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.pill.active:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.pill.active .pill-icon {
    filter: brightness(1.2);
    transform: scale(1.1);
}

.pill-icon {
    font-size: 14px;
    line-height: 1;
}

.pill-text {
    font-size: 11px;
}

@media (max-width: 768px) {
    .prompt-pills-container {
        bottom: 100px;
        padding: 6px 12px;
        gap: 6px;
    }

    .pill {
        padding: 5px 10px;
        gap: 3px;
    }

    .pill-label {
        font-size: 10px;
    }

    .pill-icon {
        font-size: 13px;
    }

    .pill-text {
        font-size: 10px;
    }
}

/* ===== 2D DOWNLOAD BUTTON ===== */
.download-2d-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-float);
    z-index: 300;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.download-2d-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.download-2d-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .download-2d-btn {
        width: 44px;
        height: 44px;
        top: 15px;
        right: 15px;
    }
}

/* ===== 3D MODEL GENERATION BADGE ===== */
.model3d-badge {
    width: auto !important;
    padding: 6px 12px !important;
    gap: 6px;
    position: relative;
    overflow: visible;
    background: var(--primary);
    color: white;
    transition: all 0.2s ease;
}

.model3d-badge:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.model3d-badge .badge-status {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Generating State - Orange with pulse animation */
.model3d-badge[data-status="generating"] {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    cursor: default;
}

.model3d-badge[data-status="generating"] .badge-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* Preview State - Blue with indicator */
.model3d-badge[data-status="preview"] {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.model3d-badge[data-status="preview"]:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.model3d-badge[data-status="preview"]::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 10px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

/* ===== 3D MODAL PLACEHOLDER ===== */
.model-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    text-align: center;
    padding: 40px;
}

.model-placeholder svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.model-placeholder p {
    margin: 0;
    font-size: 16px;
}

/* Spinner for loading state */
.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #f59e0b;
    border-radius: 50%;
    animation: spin-loader 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 3D APP IMPORT CARD (Full Width) ===== */
.action-card-wide {
    grid-column: 1 / -1; /* Span all columns */
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 20px;
    min-height: 180px;
}

.import-3d-preview {
    flex: 1;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 4px;
    min-height: 140px;
    align-items: center;
}

/* Hide scrollbar but keep functionality */
.import-3d-preview::-webkit-scrollbar {
    height: 6px;
}

.import-3d-preview::-webkit-scrollbar-track {
    background: transparent;
}

.import-3d-preview::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.import-3d-preview::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

.import-3d-preview-item {
    flex-shrink: 0;
    width: 180px;
    height: 135px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    background: var(--bg-secondary);
}

.import-3d-preview-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.import-3d-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.import-3d-preview-item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-3d-preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 40px 20px;
    margin: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.import-3d-preview-empty:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.import-3d-preview-empty.drag-over {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
    transform: scale(1.02);
}

.import-3d-preview-empty svg {
    margin-bottom: 12px;
    opacity: 0.4;
}

.import-3d-preview-empty .paste-hint {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.import-3d-preview-empty .paste-subtext {
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.import-3d-preview-empty kbd {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: monospace;
    margin: 0 2px;
}

/* ===== PASTE CARD STYLES ===== */
#paste-card {
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

#paste-card:focus,
#paste-card.focused {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

#paste-card:focus .paste-status,
#paste-card.focused .paste-status {
    color: var(--primary);
    font-weight: 500;
}

#paste-card kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.paste-status {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.paste-status.ready {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.paste-status.success {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.paste-status.error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.import-3d-info {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 250px;
}

/* Greyed out state when no images */
.action-card-wide.no-images {
    opacity: 0.6;
    background: var(--bg-secondary);
}

.action-card-wide.no-images .import-3d-info {
    min-width: auto;
}

.action-card-wide.no-images .icon {
    opacity: 0.5;
}

/* ===== 3D APP GALLERY MODAL ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 4px;
}

.gallery-item {
    position: relative;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.gallery-item:active {
    transform: translateY(0);
}

.gallery-item-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: #f5f5f5;
}

.gallery-item-info {
    padding: 12px;
    border-top: 1px solid var(--border-light);
}

.gallery-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-item-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.gallery-empty svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.gallery-empty p {
    margin: 0;
}
