:root {
    --bg-dark: #121212;
    --panel-bg: #1e1e1e;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #374151;
    --success: #10b981;
}

body {
    margin: 0; 
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex; 
    flex-direction: column; 
    align-items: center;
    min-height: 100vh;
}

.video-header {
    width: 100%; 
    max-width: 1200px;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 20px; 
    box-sizing: border-box;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.video-header h1 { 
    margin: 0; 
    font-size: 1.5rem; 
    color: #e5e7eb;
}

.nav-links a { 
    color: var(--text-muted); 
    text-decoration: none; 
    margin-left: 20px; 
    font-size: 1rem;
    transition: color 0.2s;
}

.nav-links a:hover { 
    color: var(--primary); 
}

.video-main {
    width: 100%; 
    max-width: 800px;
    padding: 0 20px; 
    box-sizing: border-box;
}

.upload-panel, .result-panel {
    background-color: var(--panel-bg);
    border-radius: 16px;
    padding: 50px 40px;
    border: 2px dashed var(--border);
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.upload-panel.dragover {
    border-color: var(--primary);
    background-color: #252f3f;
    transform: scale(1.02);
}

.icon-upload { 
    font-size: 4rem; 
    margin-bottom: 15px; 
}

#uploadPrompt h2 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

#uploadPrompt p {
    color: var(--text-muted);
}

#videoPlayer { 
    width: 100%; 
    max-height: 400px; 
    border-radius: 8px; 
    margin-bottom: 15px; 
    background: #000; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

#fileInfo { 
    color: var(--text-main); 
    margin-bottom: 20px; 
    font-weight: 500;
}

.progress-bar-container {
    width: 100%; 
    height: 20px; 
    background: var(--bg-dark);
    border-radius: 10px; 
    overflow: hidden; 
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%; 
    background: linear-gradient(90deg, var(--primary), #60a5fa); 
    width: 0%;
    transition: width 0.2s; 
    font-size: 12px; 
    line-height: 20px; 
    color: white;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn {
    padding: 12px 28px; 
    border: none; 
    border-radius: 8px;
    font-size: 1.1rem; 
    cursor: pointer; 
    font-weight: 600;
    transition: all 0.2s;
}

.btn.primary { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.btn.primary:hover:not(:disabled) { 
    background: var(--primary-hover); 
    transform: translateY(-2px);
}

.btn.secondary { 
    background: transparent; 
    color: var(--text-main); 
    border: 1px solid var(--border);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 10px;
}

.success-title {
    color: var(--success);
    font-size: 1.8rem;
    margin-bottom: 30px;
    margin-top: 0;
}

.result-item {
    display: flex; 
    align-items: center; 
    margin-bottom: 15px;
    background: var(--bg-dark); 
    padding: 12px; 
    border-radius: 8px;
    border: 1px solid var(--border);
}

.result-item label { 
    width: 100px; 
    text-align: right; 
    margin-right: 15px; 
    color: var(--text-muted);
    font-weight: bold;
}

.result-item input {
    flex: 1; 
    padding: 10px; 
    border: 1px solid var(--border);
    background: var(--panel-bg); 
    color: white; 
    border-radius: 6px; 
    outline: none;
    font-family: monospace;
}

.result-item button {
    margin-left: 15px; 
    padding: 10px 20px;
    background: var(--primary); 
    color: white; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer;
    font-weight: bold;
}

.result-item button:hover {
    background: var(--primary-hover);
}

.metadata-grid {
    display: flex; 
    justify-content: center; 
    gap: 30px; 
    margin-top: 30px; 
    margin-bottom: 30px;
    padding: 20px; 
    background: var(--bg-dark); 
    border-radius: 8px;
    border: 1px solid var(--border);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.meta-item span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.meta-item b {
    font-size: 1.2rem;
    color: var(--text-main);
}

.rss-notify {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.rss-notify p {
    margin-top: 0;
    color: #34d399;
    font-weight: bold;
}

.rss-link { 
    display: inline-block; 
    color: white; 
    font-weight: bold; 
    text-decoration: none;
    background: #059669;
    padding: 10px 20px;
    border-radius: 6px;
    transition: background 0.2s;
}

.rss-link:hover {
    background: #047857;
}

.mt-10 { 
    margin-top: 30px; 
}

.queue-item {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 5px;
}

.queue-item-title {
    font-weight: bold;
    color: var(--primary);
    word-break: break-all;
}

.queue-item-size {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.queue-item-status {
    font-size: 0.9rem;
    font-weight: bold;
}

.status-pending { color: var(--text-muted); }
.status-uploading { color: #f59e0b; }
.status-success { color: var(--success); }
.status-error { color: #ef4444; }

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

.queue-inputs input, .queue-inputs textarea, .queue-result input {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--panel-bg);
    color: white;
    box-sizing: border-box;
}

.queue-result {
    background: rgba(16, 185, 129, 0.1);
    padding: 10px;
    border-radius: 6px;
    display: none;
    flex-direction: column;
    gap: 10px;
}

.queue-result-row {
    display: flex;
    gap: 10px;
}

.queue-result-row input {
    flex: 1;
}

.queue-result-row button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    padding: 0 15px;
}

.history-panel {
    margin-top: 24px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.history-panel[hidden] {
    display: none;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.history-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.history-clear-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-weight: bold;
}

.history-clear-btn:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.history-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 24px 12px 12px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
}

.history-thumb,
.history-thumb-fallback {
    width: 84px;
    height: 84px;
    border-radius: 12px;
    flex-shrink: 0;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
}

.history-thumb {
    object-fit: cover;
}

.history-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 1.6rem;
    font-weight: bold;
}

.history-content {
    min-width: 0;
    flex: 1;
}

.history-title {
    margin: 0 0 6px;
    font-weight: bold;
    color: var(--text-main);
    word-break: break-word;
}

.history-link {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    word-break: break-all;
    margin-bottom: 6px;
}

.history-link:hover {
    color: var(--primary);
}

.history-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

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

.history-action {
    border: none;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    font-size: 0.9rem;
}

.history-action.copy {
    background: var(--primary);
    color: white;
}

.history-action.open {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .history-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-thumb,
    .history-thumb-fallback {
        width: 100%;
        height: 180px;
    }

    .history-actions {
        width: 100%;
    }
}
