/* TTS Warehouse Styles */

:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-hover: #21262d;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --purple: #a371f7;
    --radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.app {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0 20px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Navigation */
.nav {
    display: flex;
    gap: 8px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Main Content */
.main {
    min-height: 500px;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.5rem;
}

/* Queue Status */
.queue-status {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
}

.queue-stat {
    padding: 4px 12px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.queue-stat.processing {
    border-color: var(--warning);
    color: var(--warning);
}

.queue-stat.pending {
    border-color: var(--accent);
    color: var(--accent);
}

/* Section Header Actions */
.section-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sources List */
.sources-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
}

.source-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.source-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.source-title:hover {
    color: var(--accent);
}

.source-type {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 600;
}

.source-type.article { background: var(--accent); color: white; }
.source-type.rss_feed { background: var(--success); color: white; }
.source-type.royal_road { background: var(--purple); color: white; }

.source-meta {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.source-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.feed-url {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Forms */
.form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.description {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    margin-right: 8px;
}

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

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

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

.btn-secondary:hover {
    background: var(--bg-hover);
}

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

.btn-danger:hover {
    opacity: 0.9;
}

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

.back-btn {
    margin-bottom: 20px;
}

/* Preview */
.preview {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.preview.hidden {
    display: none;
}

.preview h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.preview-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.preview-meta span {
    margin-right: 16px;
}

.preview-content {
    background: var(--bg-dark);
    padding: 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    max-height: 200px;
    overflow-y: auto;
}

.preview-items {
    max-height: 300px;
    overflow-y: auto;
}

.preview-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.processing-mode {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.processing-mode.eager {
    background: var(--success);
    color: white;
}

.processing-mode.lazy {
    background: var(--warning);
    color: white;
}

/* Source Detail */
#source-detail h2 {
    margin-bottom: 20px;
}

.items-list {
    margin-top: 20px;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.item-status {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
}

.item-status.ready { background: var(--success); color: white; }
.item-status.pending { background: var(--warning); color: white; }
.item-status.processing { background: var(--accent); color: white; }
.item-status.failed { background: var(--danger); color: white; }

/* Toast */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-top: 10px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Loading */
.loading {
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

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

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--text);
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 0 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

/* Responsive */
@media (max-width: 600px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .nav {
        justify-content: center;
    }
    
    .source-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .source-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .feed-url {
        width: 100%;
    }
}
