:root {
    --bg-body: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-container: #f5f7fa;
    --bg-tab-pane: white;
    --bg-section: #f8f9fa;
    --bg-section-alt: #f1f3f4;
    --bg-input: white;
    --bg-prompt: #1e1e1e;
    --bg-prompt-header: #2d2d2d;
    --bg-stilt: #fce4ec;
    --bg-radio: #e8f5e9;
    --bg-quality: #fef9e7;
    --bg-lang-note: #e8f0fe;
    --text-primary: #2c3e50;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --text-prompt: #d4d4d4;
    --border-color: #e9ecef;
    --border-input: #ced4da;
    --shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

body.dark-mode {
    --bg-body: linear-gradient(135deg, #0a0a1a 0%, #111 100%);
    --bg-container: #1a1a2e;
    --bg-tab-pane: #222;
    --bg-section: #2a2a3e;
    --bg-section-alt: #2d2d3f;
    --bg-input: #333;
    --bg-stilt: #3a1a2e;
    --bg-radio: #1a3a1a;
    --bg-quality: #3a3a1a;
    --bg-lang-note: #1a1a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #bbb;
    --text-muted: #888;
    --border-color: #444;
    --border-input: #555;
    --shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-body);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}
.container {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--bg-container);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.tabs {
    display: flex;
    background: #2c3e50;
    flex-wrap: wrap;
}
.tab-btn {
    background: #34495e;
    border: none;
    padding: 10px 14px;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s;
}
.tab-btn:hover { background: #3d5a73; }
.tab-btn.active { background: #27ae60; }
.tab-pane {
    display: none;
    padding: 20px;
    background: var(--bg-tab-pane);
}
.tab-pane.active { display: block; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}
.form-section {
    background: var(--bg-section);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
}
.form-section h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #27ae60;
    color: var(--text-primary);
    font-size: 16px;
    transition: color 0.3s;
}
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
    transition: color 0.3s;
}
.form-group select, .form-group input, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.3s, background 0.3s, color 0.3s;
}
.form-group select.is-invalid,
.form-group input.is-invalid,
.form-group textarea.is-invalid {
    border-color: #e74c3c;
    background-color: #fff5f5;
}
body.dark-mode .form-group select.is-invalid,
body.dark-mode .form-group input.is-invalid,
body.dark-mode .form-group textarea.is-invalid {
    background-color: #3a1a1a;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 10px 0;
    padding: 10px;
    background: var(--bg-radio);
    border-radius: 8px;
}
.warning-box {
    background: #fff3e0;
    border-left: 4px solid #f39c12;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    color: #e65100;
}
body.dark-mode .warning-box {
    background: #3a2a1a;
    color: #ffb74d;
}
.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    color: #0d47a1;
}
body.dark-mode .info-box {
    background: #1a2a3a;
    color: #64b5f6;
}
.success-box {
    background: #e8f5e9;
    border-left: 4px solid #27ae60;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    color: #2e7d32;
}
body.dark-mode .success-box {
    background: #1a3a1a;
    color: #81c784;
}
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}
button {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-primary { background: #27ae60; color: white; }
.btn-primary:hover { background: #219a52; }
.btn-secondary { background: #3498db; color: white; }
.btn-secondary:hover { background: #2980b9; }
.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #e67e22; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-info { background: #1abc9c; color: white; }
.btn-info:hover { background: #16a085; }
.btn-quick { background: #ff6b6b; color: white; }
.btn-quick:hover { background: #ee5a5a; }
.btn-select-all { background: #2980b9; color: white; }
.btn-select-all:hover { background: #1c6da0; }
.btn-clear-all { background: #95a5a6; color: white; }
.btn-clear-all:hover { background: #7f8c8d; }
.btn-dark { background: #2c3e50; color: white; }
.btn-dark:hover { background: #1a252f; }
.btn-export { background: #8e44ad; color: white; }
.btn-export:hover { background: #7d3c98; }
.prompt-output {
    margin-top: 20px;
    background: var(--bg-prompt);
    border-radius: 12px;
    overflow: hidden;
}
.prompt-header {
    background: var(--bg-prompt-header);
    padding: 10px 15px;
    color: #f5f5f5;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.badge {
    background: #27ae60;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}
.badge-info { background: #3498db; }
.badge-warning { background: #f39c12; }
.badge-cyan { background: #00bcd4; }
.badge-gold { background: linear-gradient(135deg, #d4af37 0%, #f39c12 100%); color: #2c3e50; font-weight: bold; }
.badge-eng { background: #e74c3c; }
.badge-2d { background: #2980b9; }
.badge-3d { background: #9b59b6; }
.badge-tech { background: #16a085; }
.badge-photo { background: #e67e22; }
.badge-color-tech { background: #8e44ad; }
.prompt-text {
    width: 100%;
    min-height: 450px;
    padding: 15px;
    background: var(--bg-prompt);
    color: var(--text-prompt);
    border: none;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
}
.database-panel { background: var(--bg-section-alt); border-radius: 12px; padding: 15px; margin-top: 20px; border: 1px solid var(--border-color); }
.stilt-preview { background: var(--bg-stilt); border-radius: 12px; padding: 15px; margin-top: 15px; border: 1px solid #f48fb1; }
.flow-chart {
    background: var(--bg-section);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}
.flow-step {
    display: inline-block;
    background: #27ae60;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    margin: 5px;
    font-size: 12px;
}
.flow-arrow {
    display: inline-block;
    font-size: 20px;
    margin: 0 5px;
    color: var(--text-primary);
}
.display-option-card {
    background: var(--bg-tab-pane);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    transition: background 0.3s, border-color 0.3s;
}
.quick-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    padding: 10px;
    background: var(--bg-section);
    border-radius: 8px;
    margin-bottom: 15px;
}
.option-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    margin: 0;
}
.style-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-radio);
    border-radius: 8px;
}
.style-selector label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}
.status-msg {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #27ae60;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 1000;
    animation: fadeOut 3s forwards;
}
.info-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.info-text-success {
    background: #e8f5e9;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #2e7d32;
}
body.dark-mode .info-text-success {
    background: #1a3a1a;
    color: #81c784;
}
.render-quality-selector {
    background: var(--bg-quality);
    border: 1px solid #f39c12;
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
}
.lang-note {
    background: var(--bg-lang-note);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #1a237e;
}
body.dark-mode .lang-note {
    color: #64b5f6;
}
.validation-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 2px;
    display: none;
}
.validation-error.show {
    display: block;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 15px;
}
.stat-card {
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    transition: background 0.3s, border-color 0.3s;
}
.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #27ae60;
}
.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2c3e50;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s;
}
.dark-mode-toggle:hover { transform: scale(1.1); }

/* Mobile Responsive */
@media (max-width: 768px) {
    body { padding: 10px; }
    .tab-btn { font-size: 10px; padding: 8px 10px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .prompt-header { flex-direction: column; align-items: flex-start; }
    .prompt-text { min-height: 300px; font-size: 11px; }
    .button-group { flex-direction: column; }
    .button-group button { width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .tab-btn { font-size: 9px; padding: 6px 8px; }
    .tab-pane { padding: 12px; }
    .dark-mode-toggle { top: 10px; right: 10px; width: 34px; height: 34px; font-size: 14px; }
}
