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

:root {
    /* Dark theme (default) */
    --bg-primary: #2d2d2d;
    --bg-secondary: #3a3a3a;
    --bg-tertiary: #4a4a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #999;
    --border-color: #555;
    --accent-color: #4a90e2;
    --accent-hover: #357abd;
}

body.light-theme {
    /* Light theme */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --accent-color: #4a90e2;
    --accent-hover: #357abd;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Main Content Area (Left) */
.main-content {
    flex: 1;
    background: var(--bg-secondary);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #555;
}

.gallery-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.refresh-btn {
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #357abd;
    transform: rotate(180deg);
}

.images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.images-gallery .placeholder-text {
    grid-column: 1 / -1;
    color: #999;
    font-size: 18px;
    text-align: center;
    padding: 60px 20px;
}

.gallery-item {
    position: relative;
    background: #4a4a4a;
    border: 2px solid #555;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #4a90e2;
}

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

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

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

.gallery-item-btn {
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.gallery-item-btn:hover {
    background: #357abd;
}

.gallery-item-btn.download {
    background: #27ae60;
}

.gallery-item-btn.download:hover {
    background: #229954;
}

/* Control Sidebar (Right) */
.sidebar {
    width: 350px;
    background: #3a3a3a;
    border-left: 1px solid #555;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.app-title {
    font-size: 28px;
    font-weight: 600;
    color: #e0e0e0;
    text-align: center;
    margin-bottom: 10px;
}

/* Mode Switch Buttons */
.mode-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #555;
    background: #4a4a4a;
    color: #b0b0b0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    border-color: #4a90e2;
    color: #4a90e2;
    background: #4a4a4a;
}

.mode-btn.active {
    background: #4a90e2;
    color: #ffffff;
    border-color: #4a90e2;
}

/* File Import Area */
.file-import-area {
    margin-bottom: 10px;
}

.upload-group {
    margin-bottom: 15px;
}

.upload-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.model-drop-zone {
    border-color: #4a90e2;
    background: #f0f7ff;
}

.clothes-drop-zone {
    border-color: #e74c3c;
    background: #4a3a3a;
}

.drop-zone {
    width: 100%;
    min-height: 200px;
    border: 2px dashed #666;
    border-radius: 8px;
    background: #4a4a4a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.drop-zone:hover {
    border-color: #4a90e2;
    background: #555;
}

.drop-zone.dragover {
    border-color: #4a90e2;
    background: #5a5a5a;
    transform: scale(1.02);
}

.drop-zone-content {
    text-align: center;
    padding: 20px;
}

.drop-text {
    font-size: 16px;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.drop-hint {
    font-size: 12px;
    color: #999;
}

.file-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    padding: 10px;
    background: #4a4a4a;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #b0b0b0;
    margin-bottom: 8px;
    position: relative;
}

.file-item-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-preview-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-remove {
    color: #e74c3c;
    cursor: pointer;
    margin-left: 10px;
    font-weight: bold;
}

/* Format Selector */
.format-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-selector label {
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
}

.format-selector select {
    padding: 12px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #4a4a4a;
    font-size: 14px;
    color: #e0e0e0;
    cursor: pointer;
}

.format-selector select:focus {
    outline: none;
    border-color: #4a90e2;
}

/* Prompt Selector */
.prompt-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-selector label {
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
}

.prompt-selector select {
    padding: 12px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #4a4a4a;
    font-size: 14px;
    color: #e0e0e0;
    cursor: pointer;
}

.prompt-selector select:focus {
    outline: none;
    border-color: #4a90e2;
}

/* Generate Mode Styles */
.prompt-input-group {
    margin-bottom: 15px;
}

.prompt-input-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #4a4a4a;
    font-size: 14px;
    color: #e0e0e0;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

.prompt-input-group textarea:focus {
    outline: none;
    border-color: #4a90e2;
}

.prompt-input-group textarea::placeholder {
    color: #888;
}

.optional-upload {
    margin-top: 15px;
}

.generate-drop-zone {
    border-color: #666;
    background: #4a4a4a;
}

/* Start Button */
.start-button {
    width: 100%;
    padding: 15px;
    background: #4a90e2;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
}

.start-button:hover {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.start-button:active {
    transform: translateY(0);
}

.start-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Status Panel (Bottom) */
.status-panel {
    background: #3a3a3a;
    border-top: 1px solid #555;
    padding: 0 30px;
}

.status-content {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    padding: 15px 0;
    min-height: 50px;
}

.status-label {
    font-weight: 600;
    color: #e0e0e0;
    font-size: 14px;
}

.status-item {
    font-size: 13px;
    color: #b0b0b0;
    padding: 5px 12px;
    background: #4a4a4a;
    border-radius: 4px;
}

.status-item span {
    font-weight: 600;
    color: #4a90e2;
}

.queue-toggle-btn {
    margin-left: auto;
    padding: 8px 16px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.queue-toggle-btn:hover {
    background: #357abd;
}

.queue-details {
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #555;
    padding: 15px;
    background: #4a4a4a;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.queue-header h3 {
    font-size: 16px;
    color: #e0e0e0;
    margin: 0;
}

.close-queue {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-queue:hover {
    background: #555;
    color: #e0e0e0;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    background: #3a3a3a;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.queue-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cancel-job-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    line-height: 1;
}

.cancel-job-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

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

.queue-item-id {
    font-weight: 600;
    color: #e0e0e0;
}

.queue-item-type {
    font-size: 11px;
    color: #999;
    text-transform: capitalize;
}

.queue-item-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.queue-item-status.pending {
    background: #6a5a3a;
    color: #ffd700;
}

.queue-item-status.running {
    background: #3a5a6a;
    color: #4a90e2;
}

.queue-item-status.done {
    background: #3a6a4a;
    color: #4ade80;
}

.queue-item-status.cancelled {
    background: #6a4a4a;
    color: #ff6b6b;
}

.queue-item-status.failed {
    background: #6a4a4a;
    color: #ff6b6b;
}

/* History Controls */
.history-controls {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-search-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.history-search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
}

.history-search-input:focus {
    outline: none;
    border-color: #4a90e2;
}

.history-filter-select {
    padding: 8px 12px;
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
}

.history-filter-select:focus {
    outline: none;
    border-color: #4a90e2;
}

.history-filter-date {
    padding: 8px 12px;
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
}

.history-filter-date:focus {
    outline: none;
    border-color: #4a90e2;
}

.history-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.history-action-btn {
    padding: 8px 16px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-action-btn:hover:not(:disabled) {
    background: #357abd;
    transform: translateY(-1px);
}

.history-action-btn:disabled {
    background: #555;
    color: #999;
    cursor: not-allowed;
}

.history-item {
    position: relative;
}

.history-item.selected {
    background: #4a4a5a;
    border-color: #4a90e2;
}

.history-item-checkbox {
    margin-right: 10px;
    display: flex;
    align-items: center;
}

.history-item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4a90e2;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }
    
    .container {
        flex-direction: column;
    }
    
    .main-content {
        order: 2;
        min-height: 50vh;
    }
    
    .sidebar {
        order: 1;
        width: 100%;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .images-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .status-panel {
        position: relative;
        max-height: 40vh;
    }
    
    .status-content {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .queue-details {
        max-height: 60vh;
    }
    
    .history-controls {
        flex-direction: column;
    }
    
    .history-search-filter {
        flex-direction: column;
    }
    
    .history-search-input,
    .history-filter-select,
    .history-filter-date {
        width: 100%;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .file-import-area {
        padding: 10px;
    }
    
    .drop-zone {
        min-height: 120px;
        padding: 15px;
    }
    
    .mode-switch {
        flex-wrap: wrap;
    }
    
    .mode-btn {
        flex: 1;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .images-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .gallery-item {
        aspect-ratio: 1;
    }
    
    .status-panel {
        font-size: 12px;
    }
    
    .queue-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .history-actions {
        flex-direction: column;
    }
    
    .history-action-btn {
        width: 100%;
    }
}

/* Notification system */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: #27ae60;
}

.notification-error {
    background: #e74c3c;
}

.notification-warning {
    background: #f39c12;
}

.notification-info {
    background: #3498db;
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-actions {
    margin-top: 20px;
}

