/* MindGowes Video — Dark Theme */
:root {
 --bg: #0a0a0f;
 --bg-card: #12121a;
 --bg-input: #1a1a28;
 --bg-hover: #1e1e2e;
 --border: #2a2a3a;
 --text: #e4e4ef;
 --text-dim: #8888a0;
 --accent: #8b5cf6;
 --accent-hover: #7c3aed;
 --accent-glow: rgba(139, 92, 246, 0.15);
 --success: #22c55e;
 --error: #ef4444;
 --warning: #f59e0b;
 --radius: 12px;
}

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

body {
 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
 background: var(--bg);
 color: var(--text);
 min-height: 100vh;
}

/* Auth */
.auth-container {
 display: flex; align-items: center; justify-content: center;
 min-height: 100vh; padding: 20px;
}
.auth-card {
 background: var(--bg-card);
 border: 1px solid var(--border);
 border-radius: 16px;
 padding: 40px;
 width: 100%; max-width: 400px;
}
.logo { text-align: center; margin-bottom: 32px; }
.logo h1 { font-size: 24px; margin-top: 12px; }
.logo .subtitle { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.tab-switch {
 display: flex; gap: 4px;
 background: var(--bg-input);
 border-radius: 8px; padding: 4px;
 margin-bottom: 24px;
}
.tab {
 flex: 1; padding: 10px;
 background: none; border: none;
 color: var(--text-dim); cursor: pointer;
 border-radius: 6px; font-size: 14px; font-weight: 500;
 transition: all 0.2s;
}
.tab.active { background: var(--accent); color: white; }

.input-group { margin-bottom: 16px; }
.input-group label {
 display: block; font-size: 13px;
 color: var(--text-dim); margin-bottom: 6px; font-weight: 500;
}
.input-group input, .input-group textarea, .input-group select {
 width: 100%; padding: 12px 14px;
 background: var(--bg-input);
 border: 1px solid var(--border);
 border-radius: 8px; color: var(--text);
 font-size: 14px; outline: none;
 transition: border-color 0.2s;
}
.input-group input:focus, .input-group textarea:focus {
 border-color: var(--accent);
 box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-group textarea { resize: vertical; font-family: inherit; }

.btn-primary {
 width: 100%; padding: 12px;
 background: var(--accent); color: white;
 border: none; border-radius: 8px;
 font-size: 15px; font-weight: 600;
 cursor: pointer; transition: all 0.2s;
 display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.error-msg {
 background: rgba(239, 68, 68, 0.1);
 border: 1px solid rgba(239, 68, 68, 0.3);
 color: var(--error); padding: 10px 14px;
 border-radius: 8px; font-size: 13px;
 margin-bottom: 16px;
}

/* Topbar */
.topbar {
 display: flex; align-items: center; justify-content: space-between;
 padding: 16px 24px;
 background: var(--bg-card);
 border-bottom: 1px solid var(--border);
 position: sticky; top: 0; z-index: 100;
 backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-badge {
 background: var(--bg-input); padding: 6px 14px;
 border-radius: 20px; font-size: 13px; color: var(--text-dim);
}
.btn-sm {
 padding: 6px 14px; background: var(--bg-input);
 border: 1px solid var(--border); border-radius: 8px;
 color: var(--text-dim); cursor: pointer; font-size: 13px;
 transition: all 0.2s;
}
.btn-sm:hover { border-color: var(--error); color: var(--error); }

/* Container */
.container { max-width: 960px; margin: 0 auto; padding: 32px 24px; }

/* Generate Section */
.generate-section {
 background: var(--bg-card);
 border: 1px solid var(--border);
 border-radius: var(--radius);
 padding: 28px;
 margin-bottom: 32px;
}
.generate-section h2 { font-size: 20px; margin-bottom: 20px; }

.mode-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.mode-tab {
 padding: 8px 20px;
 background: var(--bg-input);
 border: 1px solid var(--border);
 border-radius: 8px; color: var(--text-dim);
 cursor: pointer; font-size: 13px; font-weight: 500;
 transition: all 0.2s;
}
.mode-tab.active { background: var(--accent); color: white; border-color: var(--accent); }

.image-source-tabs { display: flex; gap: 6px; }
.src-tab {
 padding: 6px 16px;
 background: var(--bg-input);
 border: 1px solid var(--border);
 border-radius: 6px; color: var(--text-dim);
 cursor: pointer; font-size: 12px;
 transition: all 0.2s;
}
.src-tab.active { background: var(--accent); color: white; border-color: var(--accent); }

.ratio-options { display: flex; gap: 8px; }
.ratio-btn {
 padding: 8px 20px;
 background: var(--bg-input);
 border: 1px solid var(--border);
 border-radius: 8px; color: var(--text-dim);
 cursor: pointer; font-size: 13px;
 transition: all 0.2s;
}
.ratio-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.btn-generate { margin-top: 8px; }

.spinner {
 width: 18px; height: 18px;
 border: 2px solid rgba(255,255,255,0.3);
 border-top-color: white;
 border-radius: 50%;
 animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* History */
.history-section { margin-top: 16px; }
.history-section h2 { font-size: 20px; margin-bottom: 20px; }

.history-grid {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
 gap: 16px;
}

.history-card {
 background: var(--bg-card);
 border: 1px solid var(--border);
 border-radius: var(--radius);
 overflow: hidden;
 transition: all 0.2s;
}
.history-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card-preview {
 aspect-ratio: 16/9;
 background: var(--bg-input);
 display: flex; flex-direction: column;
 align-items: center; justify-content: center;
 overflow: hidden; position: relative;
}
.card-preview video {
 width: 100%; height: 100%;
 object-fit: cover; cursor: pointer;
}
.processing-preview { background: linear-gradient(135deg, #12121a 0%, #1a1a2e 100%); }

.processing-anim { position: relative; display: flex; align-items: center; justify-content: center; }
.pulse-ring {
 position: absolute;
 width: 60px; height: 60px;
 border: 2px solid var(--accent);
 border-radius: 50%;
 animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
 0% { transform: scale(0.8); opacity: 1; }
 100% { transform: scale(1.6); opacity: 0; }
}

.status-label {
 color: var(--text-dim); font-size: 12px;
 margin-top: 12px; font-weight: 500;
}
.status-icon { font-size: 36px; }

.card-info { padding: 14px; }
.card-prompt {
 font-size: 13px; color: var(--text);
 line-height: 1.4;
 display: -webkit-box; -webkit-line-clamp: 2;
 -webkit-box-orient: vertical; overflow: hidden;
 margin-bottom: 8px;
}
.card-badge {
 display: inline-block; padding: 3px 10px;
 border-radius: 12px; font-size: 11px; font-weight: 600;
 text-transform: uppercase;
}
.card-badge.queued { background: rgba(139,92,246,0.15); color: var(--accent); }
.card-badge.processing { background: rgba(139,92,246,0.15); color: var(--accent); }
.card-badge.completed { background: rgba(34,197,94,0.15); color: var(--success); }
.card-badge.failed { background: rgba(239,68,68,0.15); color: var(--error); }
.card-badge.timeout { background: rgba(245,158,11,0.15); color: var(--warning); }
.card-badge.expired { background: rgba(136,136,160,0.15); color: var(--text-dim); }

.empty-state {
 grid-column: 1 / -1;
 text-align: center; padding: 60px 20px;
 color: var(--text-dim); font-size: 15px;
}

/* Modal */
.modal {
 position: fixed; inset: 0;
 background: rgba(0,0,0,0.85);
 display: flex; align-items: center; justify-content: center;
 z-index: 1000; padding: 20px;
}
.modal-content {
 background: var(--bg-card);
 border: 1px solid var(--border);
 border-radius: 16px;
 max-width: 800px; width: 100%;
 overflow: hidden; position: relative;
}
.modal-content video { width: 100%; display: block; }
.modal-close {
 position: absolute; top: 12px; right: 12px;
 width: 36px; height: 36px;
 background: rgba(0,0,0,0.6); border: none;
 border-radius: 50%; color: white;
 font-size: 20px; cursor: pointer; z-index: 10;
 display: flex; align-items: center; justify-content: center;
}
.modal-prompt {
 padding: 16px; color: var(--text-dim);
 font-size: 13px; line-height: 1.4;
}

/* Queue */
.queue-info {
 background: var(--bg-card);
 border: 1px solid var(--border);
 border-radius: 8px; padding: 16px;
 font-size: 13px; color: var(--text-dim);
}

/* Responsive */
@media (max-width: 640px) {
 .container { padding: 16px; }
 .generate-section { padding: 20px; }
 .history-grid { grid-template-columns: 1fr; }
 .auth-card { padding: 28px 20px; }
}

.card-id {
 font-size: 0.7rem;
 color: #8b5cf6;
 font-family: monospace;
 opacity: 0.8;
 display: block;
 margin-top: 4px;
 word-break: break-all;
}

/* === API Documentation === */
.api-docs-section {
margin-top: 40px;
padding-top: 32px;
border-top: 1px solid var(--border);
}

.api-docs-section h2 {
margin-bottom: 4px;
}

.api-subtitle {
color: var(--text-dim);
font-size: 14px;
margin-bottom: 24px;
}

.api-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
margin-bottom: 16px;
}

.api-card-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
}

.api-card-header h3 {
font-size: 16px;
color: var(--text);
}

.api-icon {
font-size: 20px;
}

.api-copybox {
display: flex;
align-items: center;
gap: 10px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 8px;
padding: 10px 14px;
overflow-x: auto;
}

.api-copybox code {
flex: 1;
font-family: 'JetBrains Mono', 'Fira Code', monospace;
font-size: 13px;
color: var(--accent);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.token-display {
font-size: 11px !important;
word-break: break-all;
white-space: normal !important;
}

.btn-copy {
background: var(--accent);
color: white;
border: none;
padding: 6px 14px;
border-radius: 6px;
font-size: 12px;
cursor: pointer;
white-space: nowrap;
transition: background 0.2s;
}

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

.api-note {
color: var(--text-dim);
font-size: 13px;
margin-bottom: 10px;
}

.api-note code {
background: var(--bg-input);
padding: 2px 6px;
border-radius: 4px;
font-size: 12px;
color: var(--accent);
}

.api-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}

.api-table th {
text-align: left;
padding: 10px 12px;
color: var(--text-dim);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
border-bottom: 1px solid var(--border);
}

.api-table td {
padding: 10px 12px;
color: var(--text);
border-bottom: 1px solid var(--border);
font-family: 'JetBrains Mono', monospace;
}

.api-table tr:last-child td {
border-bottom: none;
}

.method-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 11px;
font-weight: 700;
font-family: 'JetBrains Mono', monospace;
}

.method-badge.post {
background: rgba(139, 92, 246, 0.2);
color: #a78bfa;
}

.method-badge.get {
background: rgba(34, 197, 94, 0.2);
color: #4ade80;
}

.api-tabs {
display: flex;
gap: 4px;
margin-bottom: 0;
background: var(--bg-input);
border-radius: 8px 8px 0 0;
padding: 4px 4px 0;
}

.api-tab {
background: transparent;
border: none;
color: var(--text-dim);
padding: 8px 16px;
font-size: 13px;
cursor: pointer;
border-radius: 6px 6px 0 0;
transition: all 0.2s;
}

.api-tab.active {
background: var(--bg-card);
color: var(--accent);
}

.code-container {
position: relative;
background: var(--bg-input);
border-radius: 0 0 8px 8px;
border: 1px solid var(--border);
border-top: none;
}

.code-container.code-copy {
position: absolute;
top: 8px;
right: 8px;
font-size: 11px;
padding: 4px 10px;
}

.code-container pre {
padding: 16px;
padding-right: 80px;
overflow-x: auto;
margin: 0;
}

.code-container code {
font-family: 'JetBrains Mono', 'Fira Code', monospace;
font-size: 12px;
color: var(--text);
line-height: 1.6;
white-space: pre;
}

.api-footer {
text-align: center;
color: var(--text-dim);
font-size: 13px;
margin-top: 16px;
}

.api-footer a {
color: var(--accent);
text-decoration: none;
}

.api-footer a:hover {
text-decoration: underline;
}

@media (max-width: 600px) {
.api-table td,.api-table th {
padding: 8px 6px;
font-size: 11px;
}
.api-copybox {
flex-direction: column;
align-items: stretch;
}
.api-copybox.btn-copy {
text-align: center;
}
}

/* === Main Dashboard Tabs === */
.main-tabs {
display: flex;
gap: 4px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 6px;
margin-bottom: 28px;
}

.main-tab {
flex: 1;
padding: 12px 24px;
background: transparent;
border: none;
border-radius: 8px;
color: var(--text-dim);
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}

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

.main-tab.active {
background: var(--accent);
color: white;
}

.main-tab svg {
width: 18px;
height: 18px;
}

.tab-content {
position: relative;
}

.tab-pane {
display: none;
}

.tab-pane.active {
display: block;
animation: fadeIn 0.2s ease;
}

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

/* === API Keys Management === */
.api-keys-section {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 28px;
margin-bottom: 24px;
}

.api-keys-section h2 {
font-size: 20px;
margin-bottom: 20px;
}

.key-input-row {
display: flex;
gap: 10px;
margin-bottom: 20px;
}

.key-input-row input {
flex: 1;
padding: 10px 14px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-size: 14px;
outline: none;
transition: border-color 0.2s;
}

.key-input-row input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-glow);
}

.key-input-row input::placeholder {
color: var(--text-dim);
}

.btn-secondary {
padding: 10px 20px;
background: var(--bg-input);
border: 1px solid var(--accent);
border-radius: 8px;
color: var(--accent);
font-size: 14px;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
transition: all 0.2s;
}

.btn-secondary:hover {
background: var(--accent);
color: white;
}

.new-key-result {
background: rgba(139, 92, 246, 0.08);
border: 1px solid var(--accent);
border-radius: var(--radius);
padding: 16px;
margin-bottom: 20px;
}

.new-key-result .key-warning {
color: var(--warning);
font-size: 13px;
font-weight: 600;
margin-bottom: 8px;
display: flex;
align-items: center;
gap: 6px;
}

.new-key-result .key-display {
display: flex;
align-items: center;
gap: 10px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 8px;
padding: 10px 14px;
}

.new-key-result .key-display code {
flex: 1;
font-family: 'JetBrains Mono', 'Fira Code', monospace;
font-size: 14px;
color: var(--accent);
word-break: break-all;
}

.key-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}

.key-table th {
text-align: left;
padding: 10px 12px;
color: var(--text-dim);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
border-bottom: 1px solid var(--border);
}

.key-table td {
padding: 10px 12px;
color: var(--text);
border-bottom: 1px solid var(--border);
}

.key-table tr:last-child td {
border-bottom: none;
}

.key-table code {
font-family: 'JetBrains Mono', monospace;
font-size: 12px;
color: var(--accent);
background: var(--bg-input);
padding: 2px 6px;
border-radius: 4px;
}

.btn-danger {
padding: 4px 12px;
background: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.3);
border-radius: 6px;
color: var(--error);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
}

.btn-danger:hover {
background: var(--error);
color: white;
border-color: var(--error);
}

.key-status {
display: inline-block;
padding: 2px 8px;
border-radius: 10px;
font-size: 11px;
font-weight: 600;
}

.key-status.active {
background: rgba(34, 197, 94, 0.15);
color: var(--success);
}

.key-status.revoked {
background: rgba(239, 68, 68, 0.15);
color: var(--error);
}

.empty-keys {
text-align: center;
padding: 32px 20px;
color: var(--text-dim);
font-size: 14px;
}

.api-auth-note {
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 8px;
padding: 14px;
margin-bottom: 16px;
font-size: 13px;
color: var(--text-dim);
line-height: 1.5;
}

.api-auth-note code {
background: var(--bg-card);
padding: 2px 6px;
border-radius: 4px;
font-size: 12px;
color: var(--accent);
}

@media (max-width: 640px) {
.main-tabs {
flex-direction: row;
}
.main-tab {
padding: 10px 16px;
font-size: 13px;
}
.key-input-row {
flex-direction: column;
}
.key-table {
font-size: 11px;
}
.key-table th, .key-table td {
padding: 8px 6px;
}
}
