/* ============================================
   Kie.ai Grok Video Generator
   Dark theme với amber accent
   ============================================ */

/* ----- Reset & Base ----- */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    background: #0f0f0f;
    color: #e8e8e8;
    line-height: 1.5;
}

h1 {
    color: #d4a84a;
    font-weight: 500;
}

h1 small {
    color: #888;
    font-size: 14px;
}

/* ----- Panel (form & task list container) ----- */
.panel {
    background: #1a1a1a;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid #2a2a2a;
    margin-bottom: 20px;
}

.panel h3 {
    margin-top: 0;
}

/* ----- Form elements ----- */
label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    background: #0f0f0f;
    border: 1px solid #2a2a2a;
    color: #e8e8e8;
    border-radius: 3px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #d4a84a;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* ----- Button ----- */
button {
    margin-top: 20px;
    padding: 12px 24px;
    background: #d4a84a;
    color: #000;
    border: none;
    border-radius: 3px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

button:hover {
    background: #e6b750;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----- Error box ----- */
#error-box {
    background: rgba(224, 100, 100, 0.1);
    border-left: 3px solid #e06464;
    padding: 10px 14px;
    margin-top: 12px;
    color: #e06464;
    display: none;
}

#error-box.show {
    display: block;
}

/* ----- Task list ----- */
#task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task {
    background: #1a1a1a;
    padding: 16px 20px;
    border-radius: 4px;
    border-left: 3px solid #666;
}

.task.pending { border-left-color: #888; }
.task.running { border-left-color: #d4a84a; }
.task.success { border-left-color: #7cb86a; }
.task.fail    { border-left-color: #e06464; }

.task-head {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 0.08em;
}

.task-status {
    padding: 2px 8px;
    border-radius: 2px;
    font-weight: 600;
    text-transform: uppercase;
}

.task-status.pending { background: rgba(136, 136, 136, 0.2); color: #aaa; }
.task-status.running { background: rgba(212, 168, 74, 0.2); color: #d4a84a; }
.task-status.success { background: rgba(124, 184, 106, 0.2); color: #7cb86a; }
.task-status.fail    { background: rgba(224, 100, 100, 0.2); color: #e06464; }

.task-prompt {
    font-style: italic;
    color: #ccc;
    margin-bottom: 8px;
}

.task-meta {
    font-size: 11px;
    color: #777;
}

.task video {
    width: 100%;
    margin-top: 10px;
    border-radius: 3px;
}

.task-error {
    color: #e06464;
    font-size: 12px;
    margin-top: 8px;
    padding: 8px;
    background: rgba(224, 100, 100, 0.05);
    border-radius: 2px;
}

/* ----- Helpers ----- */
code {
    background: #0f0f0f;
    padding: 2px 6px;
    border-radius: 2px;
    color: #d4a84a;
    font-size: 11px;
}

a {
    color: #d4a84a;
}

.empty {
    text-align: center;
    color: #666;
    padding: 30px;
    font-style: italic;
}

/* ----- Spinner animation ----- */
.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(212, 168, 74, 0.3);
    border-top-color: #d4a84a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ----- Task progress UI ----- */
.task-progress-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: #aaa;
    margin: 8px 0;
}

.task-progress-row .spinner {
    margin-right: 4px;
}

.retry-info {
    color: #d4a84a;
}

/* Progress bar */
.progress-bar {
    position: relative;
    height: 6px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #d4a84a, #e6b750);
    transition: width 0.5s ease;
    border-radius: 3px;
}

.progress-pct {
    position: absolute;
    right: 4px;
    top: -16px;
    font-size: 10px;
    color: #888;
}

/* Warning hiển thị khi đang retry sau lỗi */
.task-warning {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(212, 168, 74, 0.08);
    border-left: 2px solid #d4a84a;
    color: #d4a84a;
    font-size: 11px;
    border-radius: 2px;
}