/* =========================================================
   PodGram — Main Stylesheet
   Edit live via Admin > Edit CSS
   ========================================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: #1a1a2e;
    background: #f1f5f9;
}

a {
    color: #7c3aed;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* ---------- Header ---------- */
header {
    background: #0f172a;
    color: #fff;
    padding: 28px 20px 20px;
    text-align: center;
}

header img {
    max-height: 80px;
    margin: 0 auto 12px;
    border-radius: 8px;
}

header h1 {
    margin: 0;
    font-size: 1.9em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ---------- Navigation ---------- */
nav {
    background: #1e293b;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

nav a {
    color: #cbd5e1;
    padding: 12px 14px;
    font-size: 0.95em;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    display: inline-block;
}

nav a:hover,
nav a.active {
    color: #f8fafc;
    border-bottom-color: #7c3aed;
    text-decoration: none;
}

/* ---------- Site Intro (homepage hero) ---------- */
.site-intro {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4c1d95 100%);
    color: #e0e7ff;
    padding: 40px 24px;
    text-align: center;
}

.site-intro p {
    max-width: 680px;
    margin: 0 auto;
    font-size: 1.15em;
    line-height: 1.8;
    opacity: 0.92;
}

.site-intro .rss-badge {
    display: inline-block;
    margin-top: 18px;
    background: #f59e0b;
    color: #1a1a2e;
    font-weight: 700;
    font-size: 0.88em;
    padding: 7px 16px;
    border-radius: 999px;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: background 0.2s;
}

.site-intro .rss-badge:hover {
    background: #fbbf24;
    text-decoration: none;
}

/* ---------- Layout Container ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px;
}

.container > h2 {
    margin: 0 0 24px;
    font-size: 1.35em;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.3px;
}

/* ---------- Episode Grid & List ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

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

/* ---------- Episode Cards ---------- */
.podcast-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.podcast-item:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    transform: translateY(-2px);
}

.podcast-item img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 14px;
}

.podcast-item h3 {
    margin: 0 0 6px;
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1.4;
    color: #0f172a;
}

.podcast-item p {
    margin: 0 0 10px;
    color: #475569;
    font-size: 0.93em;
    flex: 1;
}

.podcast-item audio {
    width: 100%;
    margin: 10px 0;
    border-radius: 4px;
}

.podcast-item .episode-links {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 0.88em;
}

.podcast-item .episode-links a {
    color: #7c3aed;
    font-weight: 600;
}

.podcast-item .episode-links a:hover {
    color: #5b21b6;
}

/* ---------- Episode Metadata ---------- */
.episode-meta {
    font-size: 0.82em;
    color: #64748b;
    margin: 0 0 8px;
    font-weight: 500;
    letter-spacing: 0.1px;
}

.episode-tags {
    margin: 0 0 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: #ede9fe;
    color: #5b21b6;
    font-size: 0.78em;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.2px;
}

/* ---------- Episode Body (Markdown) ---------- */
.episode-body {
    margin: 20px 0;
    padding: 24px;
    background: #f8fafc;
    border-left: 4px solid #7c3aed;
    border-radius: 0 8px 8px 0;
    color: #1e293b;
    line-height: 1.8;
}

.episode-body h1, .episode-body h2, .episode-body h3,
.episode-body h4, .episode-body h5, .episode-body h6 {
    margin-top: 1.4em;
    margin-bottom: 0.5em;
    color: #0f172a;
}

.episode-body p { margin: 0 0 1em; }
.episode-body ul, .episode-body ol { padding-left: 1.5em; margin-bottom: 1em; }
.episode-body li { margin-bottom: 0.3em; }
.episode-body blockquote {
    border-left: 3px solid #7c3aed;
    margin: 1em 0;
    padding: 4px 16px;
    color: #475569;
    font-style: italic;
    background: #f0f4ff;
}
.episode-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.88em;
    line-height: 1.5;
}
.episode-body code {
    background: #ede9fe;
    color: #5b21b6;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.88em;
}
.episode-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 1em;
}
.episode-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1em 0;
}
.episode-body a { color: #7c3aed; }
.episode-body hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 1.5em 0;
}

/* ---------- Single Episode Page ---------- */
.episode-page-header {
    margin-bottom: 24px;
}

.episode-page-header h2 {
    font-size: 1.7em;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px;
    line-height: 1.3;
}

.episode-page-audio {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin: 20px 0;
}

.episode-page-audio audio {
    width: 100%;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #7c3aed;
    color: #fff;
    font-weight: 600;
    font-size: 0.9em;
    padding: 9px 18px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.download-link:hover {
    background: #5b21b6;
    text-decoration: none;
    color: #fff;
}

/* ---------- Embed / Share Section ---------- */
details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 20px 0;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    font-size: 0.95em;
    user-select: none;
}

details textarea {
    width: 100%;
    font-family: monospace;
    font-size: 0.82em;
    background: #1e293b;
    color: #e2e8f0;
    border: none;
    border-radius: 6px;
    padding: 10px;
    resize: none;
    margin-top: 10px;
}

/* ---------- Stats ---------- */
.stats {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 20px;
    font-size: 0.85em;
    color: #64748b;
}

.stats p { margin: 0; }

/* ---------- Admin Forms ---------- */
form {
    background: #fff;
    padding: 24px;
    margin-bottom: 24px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.92em;
    color: #374151;
}

form input[type="text"],
form input[type="password"],
form input[type="number"],
form input[type="email"],
form input[type="datetime-local"],
form textarea,
form select {
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95em;
    color: #1a1a2e;
    transition: border-color 0.2s, box-shadow 0.2s;
}

form input:focus,
form textarea:focus,
form select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

form textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

form button[type="submit"],
form button {
    background: #7c3aed;
    color: #fff;
    padding: 10px 22px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: background 0.2s;
}

form button:hover {
    background: #5b21b6;
}

form input[type="file"] {
    margin-bottom: 10px;
    font-size: 0.9em;
}

form hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 18px 0;
}

/* ---------- Error Messages ---------- */
p.error {
    color: #dc2626;
    font-weight: 600;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 10px 14px;
}

/* ---------- Admin Table (Syndication) ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.91em;
}

table th {
    background: #1e293b;
    color: #f8fafc;
    padding: 10px 12px;
    text-align: left;
}

table td {
    padding: 9px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

table tr:nth-child(even) td {
    background: #f8fafc;
}

table tr:hover td {
    background: #f0f4ff;
}

/* ---------- Footer ---------- */
footer {
    background: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 20px;
    font-size: 0.88em;
    margin-top: 40px;
}

/* ---------- Page Content ---------- */
.page-content {
    max-width: 780px;
}

.page-content img {
    margin: 1.2em 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    header h1 { font-size: 1.4em; }

    nav {
        padding: 0 8px;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    nav a {
        padding: 10px 10px;
        font-size: 0.88em;
        white-space: nowrap;
    }

    .site-intro { padding: 28px 16px; }
    .site-intro p { font-size: 1em; }

    .container { padding: 20px 14px; }

    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .podcast-item { padding: 16px; }

    .episode-page-header h2 { font-size: 1.3em; }

    form { padding: 16px; }

    form input[type="text"],
    form input[type="password"],
    form textarea,
    form select {
        font-size: 0.9em;
    }

    table { font-size: 0.82em; }
}
