/* =============================================================================
   YELLPg — TV Guide
   Modern, responsive, mobile-first
   ============================================================================= */

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

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --accent: #ff6d00;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --border-light: #e8eaed;
    --success: #34a853;
    --error: #ea4335;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --max-w: 1140px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ─── HEADER ─────────────────────────────────────────────────── */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.site-logo:hover { text-decoration: none; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}

.header-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .header-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px 20px;
        box-shadow: var(--shadow-md);
    }
    .header-nav.open { display: flex; }
    .header-nav a {
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius-sm);
    }
}

/* ─── MAIN ───────────────────────────────────────────────────── */
.site-main {
    min-height: 60vh;
    padding: 40px 20px 80px;
}

/* ─── BREADCRUMB ─────────────────────────────────────────────── */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
}

.breadcrumb li { display: inline; }
.breadcrumb li + li::before { content: ' / '; color: var(--text-secondary); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span[aria-current="page"] { color: var(--text); font-weight: 500; }

/* ─── HOME PAGE ──────────────────────────────────────────────── */
.home-hero {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 48px;
}

.home-hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 16px;
}

.home-hero h1 span {
    color: var(--primary);
}

.home-hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Search Form ────────────────────────────────────────────── */
.search-form {
    max-width: 520px;
    margin: 0 auto 20px;
}

.search-form form {
    display: flex;
    border: 2px solid var(--border);
    border-radius: 50px;
    overflow: hidden;
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26,115,232,0.12);
}

.search-form input[type="text"] {
    flex: 1;
    padding: 15px 22px;
    border: none;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    background: transparent;
    min-width: 0;
}

.search-form button {
    padding: 15px 30px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    white-space: nowrap;
}

.search-form button:hover { background: var(--primary-dark); }
.search-form button:active { background: #1452a8; }

/* ─── Channel Grid ───────────────────────────────────────────── */
.channels-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 700px;
    margin: 0 auto;
    text-align: left;
}

@media (min-width: 500px) {
    .channels-grid { grid-template-columns: repeat(2, 1fr); }
}

.channel-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.channel-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}

.channel-card:active { transform: translateY(0); }

.channel-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-card-arrow {
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-left: 12px;
}

/* ─── HOME CONTENT SECTION ───────────────────────────────────── */
.home-content {
    max-width: 750px;
    margin: 56px auto 0;
}

.home-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.home-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: 1rem;
}

.home-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 24px 0 40px;
}

@media (min-width: 500px) {
    .home-features { grid-template-columns: repeat(2, 1fr); }
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: box-shadow 0.2s;
}

.feature-card:hover { box-shadow: var(--shadow-md); }

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
    margin: 0;
}

/* ─── HOME FAQ ───────────────────────────────────────────────── */
.home-faq {
    max-width: 750px;
    margin: 48px auto 0;
}

.home-faq h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.faq-item summary {
    padding: 18px 24px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: '+';
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item summary:hover { background: var(--bg); }

.faq-item .faq-answer {
    padding: 0 24px 18px;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ─── TV GUIDE CONTAINER ─────────────────────────────────────── */
.tv-guide-container {
    max-width: var(--max-w);
    margin: 0 auto;
}

.tv-guide-container h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    margin-bottom: 8px;
    font-weight: 700;
    line-height: 1.2;
}

.tv-guide-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 28px;
}

/* ─── CONTROLS ───────────────────────────────────────────────── */
.tv-guide-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 0;
}

@media (min-width: 600px) {
    .tv-guide-controls { flex-direction: row; gap: 16px; }
}

.tv-guide-controls .ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.tv-guide-controls label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.tv-guide-controls select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 48px;
    padding: 0 42px 0 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M10.293 3.293L6 7.586 1.707 3.293 0.293 4.707 6 10.414l5.707-5.707z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tv-guide-controls select:hover { border-color: #bbb; }
.tv-guide-controls select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}

#tv-guide-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 500;
}

/* ─── TABLE ──────────────────────────────────────────────────── */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}

.tv-guide-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

.tv-guide-table th,
.tv-guide-table td {
    padding: 14px 20px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.tv-guide-table thead th {
    background: var(--bg);
    font-weight: 700;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
}

.tv-guide-table tbody tr {
    transition: background 0.1s;
}

.tv-guide-table tbody tr:hover {
    background: var(--primary-light);
}

.tv-guide-table td.action-cell {
    text-align: center;
    white-space: nowrap;
}

.tv-guide-table tr.now,
.tv-guide-table tr.now td {
    background: #fef7e0;
    border-left: 3px solid var(--accent);
}

.tv-guide-table tr.past {
    opacity: 0.5;
}

.tv-guide-table tr.past:hover {
    opacity: 0.7;
}

.channel-name {
    font-weight: 600;
    font-size: 0.95em;
    color: var(--text);
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.88em;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}

.btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
    color: #fff;
}

.btn:active { transform: scale(0.97); }

/* ─── CHANNEL DESCRIPTION ────────────────────────────────────── */
.channel-desc {
    background: var(--surface);
    padding: 28px;
    border-radius: var(--radius);
    margin: 30px 0;
    line-height: 1.8;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.channel-desc p { margin: 0; }

/* ─── CHANNEL SECTIONS ───────────────────────────────────────── */
.channel-sections { margin: 32px 0; }
.channel-sections section { margin-bottom: 24px; }
.channel-sections h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    font-weight: 700;
}
.channel-sections p { color: var(--text-secondary); line-height: 1.7; }

/* ─── RELATED CHANNELS ───────────────────────────────────────── */
.related-channels { margin: 32px 0; }
.related-channels h3 { font-size: 1.2rem; margin-bottom: 12px; }
.related-channels h4 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 16px 0 8px;
}

.related-channels ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.related-channels li a {
    display: inline-block;
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.88em;
    font-weight: 500;
    color: var(--text);
    transition: all 0.15s;
}

.related-channels li a:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

/* ─── FAQ (Channel Page) ─────────────────────────────────────── */
.faq-section { margin: 40px 0; }
.faq-section h2 { font-size: 1.4rem; margin-bottom: 20px; }
.faq-item-channel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    background: var(--surface);
}
.faq-item-channel summary {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-item-channel summary::-webkit-details-marker { display: none; }
.faq-item-channel summary::after { content: '+'; font-size: 1.2rem; color: var(--text-secondary); }
.faq-item-channel[open] summary::after { content: '−'; }
.faq-item-channel .faq-answer {
    padding: 0 20px 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ─── SEARCH PAGE ────────────────────────────────────────────── */
.search-page h1 { margin-bottom: 16px; }
.search-count { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.95rem; }

.no-results-box {
    text-align: center;
    padding: 48px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.no-results { color: var(--text-secondary); text-align: center; padding: 40px; }
.text-center { text-align: center; }

/* ─── PAGINATION ─────────────────────────────────────────────── */
.pagination {
    margin: 32px 0;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    transition: all 0.15s;
}

.pagination .current, .pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    text-decoration: none;
}

/* ─── ERROR PAGE ─────────────────────────────────────────────── */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 2rem; margin-bottom: 12px; }
.error-page p { color: var(--text-secondary); margin-bottom: 24px; }

.error-page a {
    display: inline-block;
    padding: 14px 32px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.error-page a:hover { background: var(--primary-dark); text-decoration: none; }

/* ─── STATIC PAGES ───────────────────────────────────────────── */
.static-page { max-width: 750px; margin: 0 auto; }

.static-page h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
}

.static-updated { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 28px; }

.static-content { line-height: 1.8; color: var(--text); }
.static-content h2 { font-size: 1.3rem; font-weight: 700; margin-top: 32px; margin-bottom: 10px; }
.static-content h3 { font-size: 1.05rem; font-weight: 600; margin-top: 20px; margin-bottom: 8px; }
.static-content p { margin-bottom: 16px; color: var(--text-secondary); }
.static-content ul, .static-content ol { margin: 12px 0 16px 24px; }
.static-content li { margin-bottom: 8px; color: var(--text-secondary); }

/* ─── CONTACT ────────────────────────────────────────────────── */
.contact-methods {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 20px 0 32px;
}

@media (min-width: 600px) {
    .contact-methods { grid-template-columns: repeat(3, 1fr); }
}

.contact-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: box-shadow 0.2s;
}

.contact-card:hover { box-shadow: var(--shadow-md); }
.contact-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.contact-card p { font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.5; }
.contact-email { font-weight: 600; color: var(--primary) !important; }
.contact-social { display: flex; gap: 12px; flex-wrap: wrap; }
.contact-social a { font-weight: 600; font-size: 0.9rem; }

.contact-form { max-width: 600px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-submit {
    display: inline-block;
    padding: 14px 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.form-submit:hover { background: var(--primary-dark); }
.form-submit:active { background: #1452a8; }

/* ─── ALERTS ─────────────────────────────────────────────────── */
.alert { padding: 16px 20px; border-radius: var(--radius-sm); margin: 20px 0; font-weight: 500; font-size: 0.95rem; }
.alert-success { background: #e6f4ea; color: #137333; border: 1px solid #ceead6; }
.alert-error { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6cb; }

/* ─── FOOTER ─────────────────────────────────────────────────── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 40px 20px;
}

.footer-container {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links, .footer-social {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a, .footer-social a {
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.15s;
}

.footer-links a:hover, .footer-social a:hover { color: var(--primary); text-decoration: none; }

.footer-copyright {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-top: 24px;
    width: 100%;
}

@media (max-width: 700px) {
    .footer-container { flex-direction: column; text-align: center; }
}

/* ─── RESPONSIVE TABLE ───────────────────────────────────────── */
@media screen and (max-width: 600px) {
    .tv-guide-table thead { display: none; }

    .tv-guide-table tr {
        display: block;
        border-bottom: 1px solid var(--border);
        padding: 14px 16px;
    }

    .tv-guide-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 6px 0;
    }

    .tv-guide-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-secondary);
        text-transform: uppercase;
        font-size: 0.72em;
        letter-spacing: 0.05em;
        min-width: 80px;
    }

    .tv-guide-table tr.now {
        border-left: 3px solid var(--accent);
        background: #fef7e0;
    }

    .tv-guide-table tr.now td {
        background: transparent;
    }
}

/* ─── UTILITY ────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
