/* Clawd Cast — Podcast Manager */

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.header-inner {
    max-width: 700px;
    margin: 0 auto;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
}

.stat-item { display: flex; align-items: center; gap: 4px; }

/* Search bar */
.search-bar {
    max-width: 700px;
    margin: 16px auto;
    padding: 0 20px;
    display: flex;
    gap: 8px;
}

.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-muted); }

.search-bar button {
    padding: 12px 20px;
    border-radius: var(--radius);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.search-bar button:hover { background: var(--accent-hover); }

/* Content area */
.content {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 20px 100px;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 16px 0 8px;
}

/* Podcast cards */
.podcast-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    margin: 6px 0;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
    cursor: pointer;
}

.podcast-card:hover { border-color: var(--accent); }

.podcast-card.paused { opacity: 0.6; }

.podcast-art {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-hover);
}

.podcast-art-placeholder {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.podcast-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.podcast-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podcast-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.podcast-stats {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.podcast-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-paused { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-pending { background: rgba(139, 92, 246, 0.15); color: var(--accent); }

/* Podcast actions */
.podcast-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

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

.search-result {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    align-items: center;
}

.search-result .podcast-info { flex: 1; }

.subscribe-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.subscribe-btn:hover { background: var(--accent-hover); }
.subscribe-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Episode list (modal / detail view) */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 85dvh;
    overflow-y: auto;
    padding: 20px 20px 40px;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.modal-header .podcast-art { width: 60px; height: 60px; }

.modal-header-info { flex: 1; }
.modal-header-info h2 { font-size: 1.1rem; line-height: 1.3; }
.modal-header-info .podcast-author { margin-top: 2px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.modal-actions button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-actions button:hover { border-color: var(--accent); color: var(--accent); }
.modal-actions .btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.modal-actions .btn-danger { border-color: var(--danger); color: var(--danger); }
.modal-actions .btn-danger:hover { background: var(--danger); color: white; }

/* Episode rows */
.episode-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.episode-row:last-child { border-bottom: none; }

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

.episode-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.episode-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 10px;
}

.episode-status {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
}

.status-downloaded { background: var(--success-bg); color: var(--success); }
.status-pending { background: rgba(139, 92, 246, 0.15); color: var(--accent); }
.status-error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.dl-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 0.78rem;
    cursor: pointer;
    flex-shrink: 0;
}

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

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show { opacity: 1; }

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

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* Responsive */
@media (min-width: 600px) {
    .modal { border-radius: 20px; margin-bottom: 20px; }
}
