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

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #272727;
    --text-primary: #f1f1f1;
    --text-secondary: #aaa;
    --accent: #ff0000;
    --accent-hover: #cc0000;
    --success: #2ecc71;
    --error: #e74c3c;
    --border: #333;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.stats {
    display: flex;
    gap: 20px;
}

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

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

.url-form {
    display: flex;
    gap: 10px;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.url-input:focus {
    border-color: var(--accent);
}

.url-input::placeholder {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

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

/* Search Results */
.search-results {
    margin-top: 10px;
}

.search-list {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.search-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.search-item:last-child {
    border-bottom: none;
}

.search-thumb {
    position: relative;
    width: 120px;
    flex-shrink: 0;
}

.search-thumb img {
    width: 100%;
    border-radius: 4px;
}

.search-thumb .duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.8);
    padding: 2px 6px;
    font-size: 0.75rem;
    border-radius: 2px;
}

.search-info {
    flex: 1;
    min-width: 0;
}

.search-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-channel, .search-views {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Sections */
section {
    margin-bottom: 30px;
}

section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: normal;
}

/* Queue */
.queue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    align-items: center;
}

.queue-item.downloading {
    border: 1px solid var(--accent);
}

.queue-item.failed {
    border: 1px solid var(--error);
}

.queue-thumb {
    width: 80px;
    flex-shrink: 0;
}

.queue-thumb img {
    width: 100%;
    border-radius: 4px;
}

.thumb-placeholder {
    width: 100%;
    padding-top: 56.25%;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.queue-info {
    flex: 1;
    min-width: 0;
}

.queue-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-channel, .queue-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

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

.progress-text, .download-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.error-text {
    font-size: 0.85rem;
    color: var(--error);
    margin-top: 4px;
}

.queue-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    align-items: center;
}

.history-icon {
    color: var(--success);
    font-size: 1.2rem;
}

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

.history-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.alert-success {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 600px) {
    .url-form {
        flex-direction: column;
    }
    
    .search-thumb {
        width: 80px;
    }
    
    .history-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
}
