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

:root {
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-subtle: #5b21b6;
    --accent-indigo: #6366f1;
    --bg: #09090b;
    --bg-card: #131316;
    --bg-card-hover: #1a1a20;
    --bg-input: #111114;
    --border: #2a2a35;
    --border-light: #3a3a45;
    --text: #e0e0e0;
    --text-muted: #888;
    --text-dim: #555;
    --white: #ffffff;
    --red: #e55;
    --red-bg: #1f1010;
    --green: #4a4;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: #0c0c0e;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon { font-size: 1rem; }

.nav-links { display: flex; gap: 1.5rem; }

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--white); }

/* ── Layout ── */
.container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ── Page Header ── */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 550px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.05);
}

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--white);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-dim); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.optional { color: var(--text-dim); font-weight: 400; font-size: 0.8rem; }

.transcript-toggle { text-align: center; margin: 0.5rem 0; }

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    padding: 0.3rem 0.6rem;
    transition: color 0.2s;
}

.text-btn:hover { color: var(--accent); }

/* ── Buttons ── */
.btn-primary {
    display: inline-block;
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
    transform: translateY(-1px);
}
.btn-sm { width: auto; padding: 0.5rem 1.2rem; font-size: 0.85rem; }

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-danger {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid #522;
    border-radius: 8px;
    color: #c66;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover { background: var(--red-bg); border-color: #833; }

/* ── Progress ── */
.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

#progress-message { color: var(--text); font-size: 0.95rem; }
.progress-sub { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.2rem; }

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #7c3aed);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ── Error ── */
.error-card { border-color: #522; background: var(--red-bg); }
.error-card p { color: var(--red); margin-bottom: 1rem; }

/* ── Sermon Cards / Grid ── */
.sermon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.sermon-card-link { text-decoration: none; }

.sermon-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 2px solid transparent;
    border-radius: 10px;
    padding: 1.25rem;
    transition: all 0.2s;
    position: relative;
}

.sermon-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    border-top: 2px solid #7c3aed;
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.1);
}

.sermon-card h3 {
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

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

.sermon-card-status {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.status-complete { background: #1a2e1a; color: var(--green); }
.status-processing { background: rgba(124, 58, 237, 0.12); color: var(--accent-light); animation: pulse 2s infinite; }
.status-error { background: var(--red-bg); color: var(--red); }
.status-pending { background: rgba(124, 58, 237, 0.08); color: #9f8abf; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.source-badge {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-dim);
    background: #151518;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.recent-section { margin-top: 2rem; }
.recent-section h2 { font-size: 1.1rem; color: var(--white); margin-bottom: 1rem; }

.view-all-link {
    display: inline-block;
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    transition: color 0.2s;
}

.view-all-link:hover { text-decoration: underline; color: var(--accent); }

/* ── Archive ── */
.archive-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 0.65rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--white);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state h2 { color: var(--white); margin-bottom: 0.5rem; }
.empty-state p { margin-bottom: 1.5rem; }
.empty-state .btn-primary { width: auto; }

/* ── Sermon Detail Header ── */
.sermon-header {
    margin-bottom: 2rem;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-block;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}

.back-link:hover { color: var(--accent-light); }

.sermon-header h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.8rem;
    color: var(--white);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.sermon-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.source-link {
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.85rem;
    margin-left: 0.5rem;
    transition: color 0.2s;
}

.source-link:hover { text-decoration: underline; color: var(--accent); }

/* ── Tabs ── */
.tabs-container {
    margin-bottom: 2rem;
}

.tabs {
    display: flex;
    gap: 0.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 0.5rem 0.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 0.6rem 0.9rem;
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:hover { color: var(--text-muted); }
.tab.active { background: var(--bg-card-hover); color: var(--accent); }

.tab-content {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 1.5rem;
}

.tab-content.active { display: block; }

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tab-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
}

/* ── Social Sub-tabs ── */
.social-subtabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.subtab {
    padding: 0.4rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.subtab:hover { border-color: var(--accent); color: var(--accent); }
.subtab.active { background: var(--accent); color: var(--white); border-color: var(--accent); }

.subtab-content { display: none; }
.subtab-content.active { display: block; }

/* ── Content ── */
.content-body {
    color: var(--text);
    line-height: 1.75;
    font-size: 0.95rem;
    word-wrap: break-word;
}

/* Plain text tabs (social, transcript, questions) keep pre-wrap */
.content-body.plain-text {
    white-space: pre-wrap;
}

.content-body h1, .content-body h2, .content-body h3 {
    color: var(--white);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.content-body h1 { font-size: 1.3rem; }
.content-body h2 { font-size: 1.15rem; }
.content-body h3 { font-size: 1.05rem; }

/* Hide first H1 if it duplicates the tab header title */
.content-body > h1:first-child { display: none; }
.content-body p { margin-bottom: 0.75rem; }

.content-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.content-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.content-hint strong { color: var(--accent); }

.transcript-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-height: 500px;
    overflow-y: auto;
}

/* ── Copy Buttons ── */
.copy-btn {
    padding: 0.35rem 0.85rem;
    background: #151518;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.copy-btn:hover { background: var(--border-light); color: var(--white); }
.copy-btn.copied { background: var(--accent); color: var(--white); border-color: var(--accent); }

.copy-btn-sm {
    padding: 0.25rem 0.6rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.copy-btn-sm:hover { color: var(--accent); border-color: var(--accent); }

/* ── Quotes ── */
.quotes-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quote-card {
    background: var(--bg);
    border-left: 3px solid var(--accent);
    padding: 1.25rem 1.5rem;
    border-radius: 0 8px 8px 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.quote-card:hover {
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.08);
}

.quote-card blockquote {
    font-size: 1.02rem;
    line-height: 1.6;
    color: var(--text);
    font-style: italic;
    border: none;
    padding: 0;
    margin: 0;
}

/* ── Quote Images ── */
.section-subhead {
    font-size: 1rem;
    color: var(--white);
    margin: 2rem 0 1rem;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.image-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.1);
}

.image-card img {
    width: 100%;
    display: block;
}

.download-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(0,0,0,0.8);
    color: var(--accent-light);
    text-align: center;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-card:hover .download-btn { opacity: 1; }

/* ── Sermon Actions ── */
.sermon-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* ── Series Badge ── */
.series-badge {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--accent-light);
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-weight: 500;
}

.sermon-card-badges { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* ── Series Filter ── */
.series-filter {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    min-width: 160px;
    transition: border-color 0.2s;
}

/* ── Content Hint ── */
.content-hint {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}
.content-hint strong { color: var(--text-muted); }

/* ── Scripture Grid ── */
.scripture-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.scripture-card {
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.scripture-card:hover {
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.08);
}

.scripture-ref {
    color: var(--accent-light);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.scripture-text {
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ── Auth Pages ── */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.3rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-card .form-group {
    margin-bottom: 1rem;
}

.auth-card .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(238, 85, 85, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-switch a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-switch a:hover {
    text-decoration: underline;
    color: var(--accent);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-muted);
}

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .navbar { padding: 0.75rem 1rem; }
    .container { padding: 1.5rem 1rem; }
    .form-row, .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
    .tabs { padding: 0.3rem 0.3rem 0; }
    .tab { padding: 0.5rem 0.6rem; font-size: 0.75rem; }
    .sermon-grid { grid-template-columns: 1fr; }
    .sermon-header h1 { font-size: 1.4rem; }
    .archive-controls { flex-direction: column; }
    .sermon-actions { flex-direction: column; }
}
