/* RedStar Studio - AI Image Generation Platform */
:root {
    --red-primary: #dc3545;
    --red-primary-light: #e57985;
    --red-dark: #c82333;
    --red-light: #f5c6cb;
    --gray-light: #f8f9fa;
    --gray-medium: #6c757d;
    --gray-dark: #343a40;
    --white: #ffffff;
    --black: #000000;
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-y: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-light);
    color: var(--gray-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Header */
.redstar-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    position: relative;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    min-width: 200px;
    height: 60px;
    line-height: 60px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.header-logo {
    height: 36px;
    width: auto;
}

.user-circle {
    width: 36px;
    height: 36px;
    background: var(--red-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.user-initial {
    color: var(--white);
    font-weight: 600;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 60px;
    min-width: 200px;
    justify-content: flex-end;
}

.usage-info {
    font-size: 12px;
    color: var(--gray-medium);
    white-space: nowrap;
    font-weight: 500;
}

.logout-btn {
    background: var(--red-primary);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

/* Main Content */
.redstar-main {
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    display: flex;
    gap: 24px;
    min-height: fit-content;
    max-width: 100%;
    overflow-x: hidden;
}

/* Left Sidebar - White Rounded Container */
.left-sidebar {
    width: 35%;
    min-width: 350px;
    max-width: 500px;
    background: var(--white);
    flex-shrink: 0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    min-height: fit-content;
    height: auto;
}

/* Tab Bar - Inside Left Container */
.tab-bar {
    display: none;
}

.left-sidebar .tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.left-sidebar .tab-btn {
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    color: var(--gray-medium);
    flex: 1;
    text-align: center;
}

.left-sidebar .tab-btn.active {
    color: var(--red-primary);
    border-bottom-color: var(--red-primary);
}

.left-sidebar .tab-btn:hover {
    color: var(--red-primary);
}

.tab-content {
    display: none;
}

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

.input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: fit-content;
}

.input-section label {
    font-weight: 600;
    color: var(--gray-dark);
    font-size: 14px;
}

.input-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

.input-section textarea:focus {
    outline: none;
    border-color: var(--red-primary);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.input-section select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    background: var(--white);
    cursor: pointer;
}

.input-section select:focus {
    outline: none;
    border-color: var(--red-primary);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.image-count-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
}

.generate-btn {
    background: var(--red-primary);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.generate-btn:disabled {
    background: var(--gray-medium);
    cursor: not-allowed;
}

/* File Upload */
.file-upload-wrapper {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    position: relative;
}

.file-upload-wrapper:hover {
    border-color: var(--red-primary);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-text {
    color: var(--gray-medium);
    font-size: 14px;
}

.file-upload-text small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
}

/* Image Preview */
.image-preview {
    position: relative;
    margin-top: 16px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.remove-preview {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gallery Area - White Rounded Container */
.gallery-area {
    width: 65%;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    min-height: 400px;
    height: auto;
    min-width: 0;
    overflow: visible;
}

.gallery-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    border-radius: 12px 12px 0 0;
}

.gallery-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-dark);
}

.gallery-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Toggle Switch Design */
.view-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-label {
    font-size: 12px;
    color: var(--gray-medium);
    margin: 0;
}

.view-toggle {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border);
    border: none;
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    overflow: hidden;
}

.view-toggle:hover {
    background: var(--red-primary-light);
}

.view-toggle.active {
    background: var(--red-primary);
}

.view-toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    z-index: 2;
}

.view-toggle.active::before {
    transform: translateX(24px);
}

.clear-all-btn {
    background: none;
    border: 1px solid var(--red-primary);
    color: var(--red-primary);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-all-btn:hover {
    background: var(--red-primary);
    color: var(--white);
}

/* Gallery Content */
.gallery-content {
    flex: 1;
    padding: 24px;
    min-height: fit-content;
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    height: auto;
}

.gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    text-align: center;
    color: var(--gray-medium);
}

.gallery-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Gallery List View */
.gallery-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: fit-content;
    height: auto;
    max-width: 100%;
    overflow-x: hidden;
}

.gallery-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
}

.gallery-item-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-item-content {
    padding: 16px;
}

.gallery-item-prompt {
    font-size: 14px;
    color: var(--gray-dark);
    margin-bottom: 12px;
    font-style: italic;
}

.gallery-item-actions {
    display: flex;
    gap: 8px;
}

/* Gallery Image Elements */
.gallery-image {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    transition: transform 0.2s ease;
    max-width: 100%;
    overflow: visible;
    height: auto;
}

.gallery-image:hover {
    transform: translateY(-2px);
}

.gallery-image img {
    width: 100%;
    height: auto;
    border-radius: 0;
    margin-bottom: 0;
    display: block;
}

.gallery-image-info {
    max-width: 100%;
    overflow: hidden;
}

.gallery-image-prompt {
    font-size: 14px;
    color: var(--gray-dark);
    margin-bottom: 12px;
    font-style: italic;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.gallery-image-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
}

.gallery-image-actions button {
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-dark);
    height: auto;
    min-height: unset;
}

.gallery-image-actions button:hover {
    background: var(--gray-light);
    border-color: var(--red-primary);
    color: var(--red-primary);
}

.gallery-image-actions button img {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.gallery-image-actions button:hover img {
    opacity: 1;
}

/* Unified Gallery Item Container */
.gallery-item-container {
    background: var(--gray-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Gallery Action Buttons - Top Position */
.gallery-image-actions-top {
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    background: var(--gray-light);
    border-bottom: 1px solid var(--border);
}

.gallery-image-actions-top button {
    background: transparent;
    border: 1px solid transparent;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    color: var(--gray-dark);
    height: auto;
    min-height: unset;
    margin: 0;
    line-height: 1;
}

.gallery-image-actions-top button:hover {
    background: var(--white);
    border-color: var(--red-primary);
    color: var(--red-primary);
}

.gallery-image-actions-top button img {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    display: block;
}

.gallery-image-actions-top button span {
    font-size: 11px;
    line-height: 16px;
    display: block;
}

.gallery-image-actions-top button:hover img {
    opacity: 1;
}

.gallery-item-container > img {
    display: block;
    width: 100%;
    height: auto;
    border: none;
}

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

.action-btn {
    background: none;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover {
    background: var(--gray-light);
}

.action-btn img {
    width: 12px;
    height: 12px;
}

/* Gallery Thumbnail View */
.gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    min-height: fit-content;
    height: auto;
}

.thumbnail-item {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.thumbnail-item:hover {
    transform: scale(1.02);
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 12px 8px 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thumbnail-item:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.thumbnail-action {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.thumbnail-action:hover {
    background: var(--white);
}

.thumbnail-action img {
    width: 14px;
    height: 14px;
}

/* Combine Tab Thumbnail Grid */
.combine-previews {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.combine-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--gray-light);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.combine-preview-item:hover {
    transform: scale(1.05);
}

.combine-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.combine-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: var(--white);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.combine-preview-remove:hover {
    background: var(--red-primary);
}

.combine-preview-number {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(40, 167, 69, 0.9);
    color: var(--white);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.combine-preview-number:hover {
    background: rgb(40, 167, 69);
}

/* Image Preview Modal */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.image-preview-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius);
}

.image-preview-modal .close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--white);
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Info Section */
.info-section {
    background: var(--gray-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 8px;
}

.info-section small {
    color: var(--gray-medium);
    font-size: 12px;
    line-height: 1.4;
}

/* Reference Buttons */
.reference-btn {
    background: var(--gray-light);
    border: 1px solid var(--border);
    padding: 6px 12px;
    margin: 4px;
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.image-references {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-light);
    border-radius: var(--radius);
}

.reference-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--gray-medium);
    width: 100%;
    text-align: center;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--red-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px auto;
}

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

/* Error Overlay */
.error-overlay {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--red-primary);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    max-width: 400px;
    text-align: center;
}

/* Footer */
.redstar-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    text-align: center;
    margin-top: auto;
    width: 100%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--gray-medium);
}

.version {
    font-family: monospace;
    color: var(--red-primary);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .left-sidebar {
        width: 40%;
        min-width: 320px;
    }
    
    .gallery-area {
        width: 60%;
    }
}

@media (max-width: 900px) {
    .left-sidebar {
        width: 45%;
        min-width: 300px;
    }
    
    .gallery-area {
        width: 55%;
    }
}

@media (max-width: 768px) {
    .redstar-main {
        padding: 16px;
        gap: 16px;
    }
    
    .content-wrapper {
        flex-direction: column;
        gap: 16px;
    }
    
    .left-sidebar {
        width: 100%;
        min-width: unset;
    }
    
    .gallery-area {
        width: 100%;
    }
    
    .gallery-thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .header-right .usage-info {
        display: none;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 8px;
    }
}

/* Comparison Modal Styles */
.comparison-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.comparison-modal-overlay.show {
    opacity: 1;
}

.comparison-modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.comparison-modal-overlay.fullscreen .comparison-modal-content {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.9);
}

.fullscreen-btn {
    position: absolute;
    top: 15px;
    right: 65px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.comparison-images {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.image-container {
    position: relative;
    width: 100%;
    height: 500px;
    background: #f5f5f5;
    overflow: hidden;
}

.edited-image,
.original-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}

.comparison-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: var(--red-primary);
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.divider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--red-primary);
    color: var(--white);
    padding: 8px 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    user-select: none;
}

.comparison-bottom-bar {
    padding: 15px;
    background: var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

.label-left,
.label-right,
.label-center {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-dark);
}

.label-center {
    font-style: italic;
    color: var(--gray-medium);
}

.thumbnail-selector {
    padding: 15px;
    background: var(--gray-light);
    border-top: 1px solid var(--border);
}

.thumbnail-selector h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--gray-dark);
}

.thumbnail-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.thumbnail-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: var(--white);
}

.thumbnail-option:hover {
    border-color: var(--red-light);
    background: var(--red-light);
}

.thumbnail-option.active {
    border-color: var(--red-primary);
    background: var(--red-light);
}

.thumbnail-option img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 4px;
}

.thumbnail-option span {
    font-size: 12px;
    text-align: center;
    color: var(--gray-dark);
    font-weight: 500;
    line-height: 1.2;
}

.thumbnail-option.active span {
    color: var(--red-primary);
    font-weight: 600;
}

/* Hamburger Menu */
.hamburger-menu {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray-dark);
    padding: 8px;
    margin-right: 12px;
}

.hamburger-menu:hover {
    background: var(--gray-light);
    border-radius: 4px;
}

/* Navigation Menu */
.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.nav-menu.active {
    visibility: visible;
    opacity: 1;
}

.nav-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.nav-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: var(--white);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.nav-menu.active .nav-content {
    transform: translateX(0);
}

.nav-header {
    padding: 20px;
    background: var(--red-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    width: 32px;
    height: 32px;
}

.nav-title {
    font-size: 1.2rem;
    font-weight: bold;
    flex: 1;
}

.nav-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.nav-links {
    list-style: none;
    padding: 0;
}

.nav-links li {
    border-bottom: 1px solid var(--border);
}

.nav-link {
    display: block;
    padding: 16px 20px;
    color: var(--gray-dark);
    text-decoration: none;
    transition: background 0.2s ease;
}

.nav-link:hover {
    background: var(--gray-light);
}

.nav-link.active {
    background: var(--red-light);
    color: var(--red-primary);
    font-weight: 500;
}

/* Page System */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Settings and About Pages */
.settings-container,
.about-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.settings-section,
.about-section {
    margin-bottom: 2rem;
}

.settings-section h3,
.about-section h3 {
    color: var(--red-primary);
    margin-bottom: 1rem;
}

.usage-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    font-weight: bold;
    color: var(--gray-medium);
}

.stat-value {
    font-size: 1.2rem;
    color: var(--red-primary);
}

.about-section ul {
    list-style: none;
    padding: 0;
}

.about-section ul li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.about-section ul li:before {
    content: "✓ ";
    color: var(--red-primary);
    font-weight: bold;
}

/* Credits List Styles */
.credits-list {
    list-style: none;
    padding-left: 0;
}

.credits-list li {
    padding: 0.25rem 0;
    border-bottom: none;
    color: var(--text-secondary);
}

.credits-list li:before {
    content: "• ";
    color: var(--red-primary);
    font-weight: bold;
    margin-right: 0.5rem;
}

/* API Configuration Styles */
.api-config {
    margin-top: 1rem;
}

.api-config label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-dark);
}

.token-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.token-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.9rem;
    background: var(--gray-light);
}

.token-input:focus {
    outline: none;
    border-color: var(--red-primary);
    background: var(--white);
}

.token-input[readonly] {
    background: var(--gray-light);
    cursor: not-allowed;
}

.edit-token-btn,
.save-token-btn,
.cancel-token-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.edit-token-btn {
    background: var(--white);
    color: var(--gray-dark);
}

.edit-token-btn:hover {
    background: var(--gray-light);
}

.save-token-btn {
    background: var(--red-primary);
    color: var(--white);
    border-color: var(--red-primary);
}

.save-token-btn:hover {
    background: var(--red-dark);
}

.cancel-token-btn {
    background: var(--white);
    color: var(--gray-medium);
}

.cancel-token-btn:hover {
    background: var(--gray-light);
}

.token-help {
    color: var(--gray-medium);
    font-size: 0.85rem;
    font-style: italic;
}
/* Debug Console */
.debug-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--red-primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.debug-toggle-btn:hover {
    background: var(--red-dark);
    transform: scale(1.1);
}

.debug-console {
    position: fixed;
    bottom: 60px;
    left: 20px;
    right: 20px;
    height: 300px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

.debug-header {
    background: #2a2a2a;
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.debug-title {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

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

.debug-btn {
    background: #333;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.debug-btn:hover {
    background: #444;
}

.debug-tabs {
    background: #2a2a2a;
    display: flex;
    gap: 0;
    border-bottom: 1px solid #333;
    padding: 0 12px;
}

.debug-tab-btn {
    background: transparent;
    color: #888;
    border: none;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.debug-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.debug-tab-btn.active {
    color: #fff;
    border-bottom-color: #4ade80;
}

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

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

.debug-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #fff;
    background: #1a1a1a;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left;
    width: 100%;
}

.debug-entry {
    margin: 2px 0;
    padding: 2px 0;
    text-align: left;
    width: 100%;
}

.debug-entry.error {
    color: #ff6b6b;
}

.debug-entry.warn {
    color: #ffd93d;
}

.debug-entry.info {
    color: #74c0fc;
}

.debug-entry.success {
    color: #51cf66;
}

/* Edit Divider */
.edit-divider {
    position: relative;
    text-align: center;
    margin: 24px 0;
}

.edit-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.edit-divider span {
    position: relative;
    display: inline-block;
    padding: 0 16px;
    background: var(--white);
    color: var(--gray-medium);
    font-weight: 600;
    font-size: 14px;
}

/* Markup Settings */
.markup-settings {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-weight: 500;
    color: var(--gray-dark);
}

.setting-item select {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--white);
    cursor: pointer;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--red-primary);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.setting-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.danger-btn {
    padding: 0.75rem 1.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.danger-btn:hover {
    background: #c82333;
}

.outline-btn {
    padding: 0.75rem 1.5rem;
    background: white;
    color: var(--red-primary);
    border: 1px solid var(--red-primary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.outline-btn:hover {
    background: var(--red-primary);
    color: white;
}

/* Edit Preview and Markup Preview */
.edit-preview,
.markup-preview {
    position: relative;
    margin-top: 12px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.edit-preview img,
.markup-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.edit-preview .remove-preview,
.markup-preview .remove-preview {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.edit-preview .remove-preview:hover,
.markup-preview .remove-preview:hover {
    background: rgba(220, 53, 69, 0.9);
}

/* Saved Markups Grid */
.saved-markups {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.saved-markups h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 16px;
}

.markups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.no-markups {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-medium);
}

.no-markups .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.no-markups p {
    margin: 8px 0 4px 0;
    font-weight: 500;
}

.no-markups small {
    font-size: 12px;
    opacity: 0.7;
}

.markup-item {
    position: relative;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s ease;
}

.markup-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.markup-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
}

.markup-item-info {
    padding: 8px;
    font-size: 11px;
    color: var(--gray-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.markup-item-info small {
    display: block;
    color: var(--gray-medium);
    font-size: 10px;
}

.markup-item-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.markup-item-actions button {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.markup-item-actions button:hover {
    background: var(--red-primary);
}

/* Annotate Modal */
.annotate-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.annotate-modal-content {
    width: 95%;
    height: 95%;
    background: var(--white);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.annotate-header {
    padding: 16px 24px;
    background: var(--gray-light);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.annotate-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--gray-dark);
}

.annotate-controls {
    display: flex;
    gap: 12px;
}

.btn-primary {
    background: var(--red-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.btn-secondary {
    background: var(--gray-medium);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.btn-red {
    background: var(--red-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.btn-dark-red {
    background: #8b0000;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-dark-red:hover {
    background: #6b0000;
}

.btn-grey {
    background: #4a4a4a;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-grey:hover {
    background: #5a5a5a;
}

.btn-icon {
    background: #4a4a4a;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-icon:hover {
    background: #5a5a5a;
}

.btn-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 12px;
    display: inline-block;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-medium);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-close:hover {
    color: var(--red-primary);
}

.annotate-body {
    flex: 1;
    overflow: hidden;
}

.annotate-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* View 2: Prepare Submission */
.annotate-view {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.annotate-view.active {
    display: flex;
}

.prepare-submission-layout {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

.preview-column {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 16px;
    min-width: 400px;
    align-items: flex-start;
}

.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.preview-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-dark);
    margin: 0;
}

.preview-canvas {
    width: 100%;
    height: auto;
    max-height: 400px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    object-fit: contain;
}

.options-column {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.options-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.options-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-dark);
    margin: 0 0 12px 0;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 14px;
}

.option-checkbox:last-child {
    margin-bottom: 0;
}

.option-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.prompt-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prompt-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-dark);
    margin: 0;
}

.prompt-template-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--white);
}

.prompt-text-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.prompt-text-container label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-medium);
    margin-bottom: 4px;
}

.auto-prompt-text {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    background: var(--gray-light);
    color: var(--gray-dark);
    resize: vertical;
}

.user-notes-text {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
}

/* Model Selector Styles */
.model-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f0f0f0;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.model-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-dark);
    white-space: nowrap;
    margin: 0;
}

.model-select-compact {
    flex: 1;
    padding: 4px 8px;
    font-size: 0.85rem;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    background-color: var(--white);
    color: var(--gray-dark);
    cursor: pointer;
}

.model-select-compact:focus {
    outline: none;
    border-color: var(--red-primary);
}

.model-select-compact:hover {
    border-color: var(--gray-medium);
}

/* Legacy model selector (keep for backward compatibility) */
.model-select {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background);
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.model-select:focus {
    outline: none;
    border-color: var(--red-primary);
}

.model-select:hover {
    border-color: var(--red-secondary);
}

.model-info {
    display: block;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.model-info.warning {
    color: var(--red-primary);
    font-weight: 500;
}

/* Button Row */
.button-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.button-row .generate-btn {
    flex: 1;
}

.reset-session-btn {
    padding: 12px 20px;
    background-color: #f8f9fa;
    color: var(--gray-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.reset-session-btn:hover {
    background-color: #e9ecef;
    border-color: var(--gray-medium);
}

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

/* Prompt Actions */
.prompt-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.prompt-action-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-dark);
}

.prompt-action-btn:hover {
    background: #f5f5f5;
    border-color: var(--red-primary);
    color: var(--red-primary);
}

.prompt-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Prompt Wizard Modal */
.wizard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wizard-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.wizard-container {
    position: relative;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: wizardSlideIn 0.3s ease-out;
}

@keyframes wizardSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wizard-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--gray-dark);
}

.wizard-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--gray-medium);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.wizard-close:hover {
    background: #f0f0f0;
    color: var(--red-primary);
}

.wizard-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.wizard-field {
    margin-bottom: 20px;
}

.wizard-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-dark);
}

.wizard-field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 60px;
}

.wizard-field textarea:focus {
    outline: none;
    border-color: var(--red-primary);
}

.quick-enhance-btn {
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    background: #f8f9fa;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.wizard-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.wizard-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-send-btn {
    background: var(--red-primary);
    color: var(--white);
}

.wizard-send-btn:hover {
    background: var(--red-dark);
}

.wizard-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wizard-use-btn {
    background: var(--red-primary);
    color: var(--white);
}

.wizard-use-btn:hover {
    background: var(--red-dark);
}

.wizard-copy-btn {
    background: #f8f9fa;
    color: var(--gray-dark);
    border: 1px solid #d0d0d0;
}

.wizard-copy-btn:hover {
    background: #e9ecef;
}

.wizard-cancel-btn {
    background: #f8f9fa;
    color: var(--gray-dark);
    border: 1px solid #d0d0d0;
}

.wizard-cancel-btn:hover {
    background: #e9ecef;
}

/* Conversation State */
.wizard-prompts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.wizard-prompt-col label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-dark);
}

.wizard-prompt-col textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.wizard-prompt-col textarea[readonly] {
    background: #f8f9fa;
}

.wizard-chat-section {
    margin-bottom: 24px;
}

.wizard-chat-section > label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--gray-dark);
}

.wizard-chat-history {
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    background: #fafafa;
    margin-bottom: 12px;
}

.chat-message {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    animation: fadeIn 0.3s;
}

.user-message {
    background: #e3f2fd;
    margin-left: 20px;
}

.ai-message {
    background: #f5f5f5;
    margin-right: 20px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.message-sender {
    font-weight: 600;
    color: var(--gray-dark);
}

.message-time {
    color: var(--gray-medium);
    font-size: 0.8rem;
}

.message-text {
    color: var(--gray-dark);
    line-height: 1.5;
    white-space: pre-wrap;
}

.wizard-chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.wizard-chat-input-wrapper textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.wizard-chat-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--red-primary);
}

.wizard-chat-input-wrapper .wizard-send-btn {
    flex-shrink: 0;
}

/* Wizard Image Context */
.wizard-image-context {
    margin: 16px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.wizard-thumbnails {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.wizard-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #d0d0d0;
    cursor: pointer;
}

.wizard-thumbnail:hover {
    border-color: var(--red-primary);
}

.wizard-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--gray-dark);
    cursor: pointer;
    user-select: none;
}

.wizard-checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.wizard-checkbox-label span {
    line-height: 1.4;
}

.wizard-history-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.wizard-undo-btn, .wizard-redo-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 1.1rem;
}

.wizard-model-selector {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wizard-model-selector label {
    font-size: 0.85rem;
    color: var(--gray-medium);
    white-space: nowrap;
}

.wizard-model-selector select {
    padding: 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--white);
    cursor: pointer;
}

/* Conversational Wizard Styles */
.wizard-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wizard-header-icon {
    width: 32px;
    height: 32px;
}

.wizard-description-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.wizard-description-row label {
    font-weight: 500;
    color: var(--gray-dark);
}

.wizard-description-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.wizard-description-header > label {
    font-weight: 500;
    color: var(--gray-dark);
}

.wizard-image-context-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wizard-thumbnails-inline {
    display: flex;
    gap: 6px;
}

.wizard-thumbnails-inline img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #d0d0d0;
}

.wizard-chat-container {
    display: flex;
    gap: 16px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    min-height: 280px;
}

.wizard-character {
    width: 150px;
    height: auto;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 0;
}

.wizard-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wizard-chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 16px 0;
    min-height: 180px;
    max-height: 350px;
}

.wizard-message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s;
}

.wizard-message-assistant {
    justify-content: flex-start;
}

.wizard-message-user {
    justify-content: flex-end;
}

.wizard-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.wizard-bubble-assistant {
    background: #4A7C96;
    color: white;
    border-radius: 12px;
}

.wizard-bubble-user {
    background: #e8e8e8;
    color: #333;
    border-radius: 12px;
}

.wizard-chat-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: auto;
}

.wizard-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}

.wizard-chat-input:focus {
    border-color: var(--red-primary);
}

.wizard-chat-input-row .wizard-btn {
    padding: 10px 18px;
    white-space: nowrap;
}

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

/* Compact Settings Panel */
.settings-panel {
    margin: 12px 0;
    padding: 8px 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.setting-item.gemini-pro-setting {
    display: none;
}

.setting-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-select {
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.setting-select:hover {
    border-color: var(--red-primary);
}

.setting-select:focus {
    outline: none;
    border-color: var(--red-primary);
    box-shadow: 0 0 0 2px rgba(161, 35, 40, 0.1);
}

/* Show Gemini Pro settings when needed */
.show-gemini-pro-settings .setting-item.gemini-pro-setting {
    display: flex;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* QT (Quick Test) Button */
.qt-button {
    background: none;
    border: 1px solid #999;
    color: #777;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.qt-button:hover {
    background: #f0f0f0;
    border-color: #666;
    color: #555;
}

.qt-button:active {
    background: #e0e0e0;
}

.label-with-qt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-with-qt label {
    margin: 0;
}

/* Custom Dimensions */
.dimension-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dimension-input {
    width: 65px;
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
}

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

.dimension-separator {
    color: var(--gray-medium);
    font-size: 0.9rem;
    font-weight: 400;
}

.conversion-result {
    font-size: 0.65rem;
    color: #aaa;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.custom-dimensions {
    grid-column: span 2;
}
