/* ===================================================================
   Auto Etsy Image Generator - Dark Theme Styles
   =================================================================== */

:root {
    --bg-primary: #111113;
    --bg-secondary: #1a1a1f;
    --bg-tertiary: #222228;
    --bg-hover: #2a2a32;
    --border: #2e2e38;
    --border-light: #3a3a46;
    --text-primary: #e8e6e3;
    --text-secondary: #9a9898;
    --text-muted: #666;
    --accent: #c8a87c;
    --accent-hover: #d4b88e;
    --accent-dim: rgba(200, 168, 124, 0.15);
    --success: #5cb85c;
    --error: #d9534f;
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Main layout */
main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Preview Panel (Left) */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    gap: 12px;
}

/* Batch area */
.batch-area {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.batch-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    padding: 40px 20px;
}

.batch-drop-zone.compact {
    padding: 12px 20px;
}

.batch-drop-zone.compact .upload-prompt svg { display: none; }
.batch-drop-zone.compact .upload-prompt p { margin-bottom: 0; }
.batch-drop-zone.compact .upload-prompt span,
.batch-drop-zone.compact .upload-prompt .formats { display: none; }

.batch-drop-zone:hover,
.batch-drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.batch-drop-zone.hidden { display: none !important; }

/* Batch list */
.batch-list {
    max-height: 35vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
}

.batch-list::-webkit-scrollbar { width: 5px; }
.batch-list::-webkit-scrollbar-track { background: transparent; }
.batch-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.batch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.batch-item:hover {
    border-color: var(--border-light);
    background: var(--bg-tertiary);
}

.batch-item.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.batch-item-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.batch-item-fields {
    flex: 1;
    display: flex;
    gap: 6px;
    min-width: 0;
}

.batch-item-fields input {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
}

.batch-item-fields input:focus {
    outline: none;
    border-color: var(--accent);
}

.batch-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
}

.batch-item-remove:hover {
    color: var(--error);
    background: rgba(217, 83, 79, 0.1);
}

.batch-add-row {
    padding: 6px 0;
    display: flex;
    justify-content: center;
}

/* Output types row */
.output-types-row {
    display: flex;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

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

.upload-prompt {
    text-align: center;
    color: var(--text-muted);
}

.upload-prompt svg { margin-bottom: 12px; }

.upload-prompt p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-prompt span {
    font-size: 13px;
    display: block;
}

.upload-prompt .formats {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Preview container */
.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.preview-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 3px;
    gap: 2px;
}

.tab {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.tab:hover { color: var(--text-primary); }

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

.preview-ratio-select {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.preview-image-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.preview-image-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 2px;
}

.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 17, 19, 0.7);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.image-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.btn-text:hover { text-decoration: underline; }

/* Settings Panel (Right) */
.settings-panel {
    width: 340px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
}

.settings-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.settings-scroll::-webkit-scrollbar { width: 6px; }
.settings-scroll::-webkit-scrollbar-track { background: transparent; }
.settings-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.settings-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

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

.settings-group h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.field {
    margin-bottom: 10px;
}

.field:last-child { margin-bottom: 0; }

.field label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.field input[type="text"],
.field select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.15s;
}

.field input[type="text"]:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
}

.field-row {
    display: flex;
    gap: 12px;
}

.field-row .field { flex: 1; }

/* Color input */
.color-input {
    display: flex;
    gap: 6px;
    align-items: center;
}

.color-input input[type="color"] {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: var(--bg-tertiary);
}

.color-text {
    flex: 1;
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: monospace;
}

/* Toggle switch */
.toggle-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px !important;
    color: var(--text-primary) !important;
}

.toggle-label input { display: none; }

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
}

.toggle-label input:checked + .toggle-switch {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
    left: 18px;
    background: var(--accent);
}

/* Range sliders */
input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-primary);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-primary);
}

.value-display {
    float: right;
    font-family: monospace;
    color: var(--accent);
    font-size: 11px;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.field-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Segmented control */
.segmented-control {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 3px;
    gap: 2px;
}

.seg-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

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

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

/* Radio buttons */
.radio-row {
    display: flex;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.radio-label input[type="radio"] {
    accent-color: var(--accent);
}

/* Ratio grid */
.ratio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.ratio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

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

.ratio-item.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.ratio-item input { display: none; }

.ratio-item .ratio-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.ratio-item .ratio-detail {
    font-size: 10px;
    color: var(--text-muted);
}

/* Footer */
footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
    gap: 16px;
}

.progress-area {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar-track {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 120px;
}

.action-area {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-primary {
    background: var(--accent);
    color: #111;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
}

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

/* Responsive */
@media (max-width: 900px) {
    main { flex-direction: column; }
    .settings-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 40vh;
    }
}
