/* StepsWoo TV Schedule - Base Styles */

#stepswoo-tv-schedule {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
}

/* StepsWoo brand style */
.tv-epg-theme-dark {
    background: #212121;
    color: #ffffff;
}
.stepswoo-tv-schedule-title {
    align-items: center;
    background: #212121;
    border-bottom: 3px solid #f36b21;
    color: #ffffff;
    display: flex;
    font-size: 20px;
    font-weight: 800;
    gap: 8px;
    padding: 15px 16px;
}
.stepswoo-tv-schedule-title-name {
    color: #f36b21;
    font-size: 15px;
    font-weight: 700;
}
.tv-epg-theme-dark .tv-epg-header,
.tv-epg-theme-dark .tv-epg-channel,
.tv-epg-theme-dark .tv-epg-timeline {
    background: #282828;
}
.tv-epg-theme-dark .tv-epg-btn {
    background: #f36b21;
    border-color: #f36b21;
    color: #ffffff;
}
.tv-epg-theme-dark .tv-epg-btn:hover { background: #d95616; border-color: #d95616; }
.tv-epg-theme-dark .tv-epg-program { background: #343434; border-color: #454545; }
.tv-epg-theme-dark .tv-epg-program:hover { background: #404040; border-color: #f36b21; }
.tv-epg-theme-dark .tv-epg-now-line,
.tv-epg-theme-dark .tv-epg-now-line::before { background: #f36b21; }
.tv-epg-theme-dark .tv-epg-logo-fallback { background: #f36b21; }

/* Action bar directly below the TV Schedule title. */
.stepswoo-schedule-social-bar {
    align-items: stretch;
    background: #1b1b1b;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: center;
    margin: 24px 0 26px;
    padding: 10px 14px;
}
.stepswoo-schedule-social-action {
    align-items: center;
    background: transparent;
    border: 0;
    border-left: 1px solid rgba(255,255,255,0.16);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 800;
    gap: 9px;
    justify-content: center;
    min-height: 38px;
    padding: 0 34px;
}
.stepswoo-schedule-social-action:first-child { border-left: 0; }
.stepswoo-schedule-social-action:hover,
.stepswoo-schedule-social-action.is-active { background: rgba(243,107,33,0.14); color: #f36b21; }
.stepswoo-social-icon { font-size: 21px; line-height: 1; }
.stepswoo-social-follow { color: #ffffff; font-size: 20px; }
.stepswoo-social-google { color: #4285f4; font-family: Arial, sans-serif; font-size: 23px; font-weight: 900; }
.stepswoo-social-check { background: #f36b21; border-radius: 50%; color: #fff; font-size: 15px; font-weight: 900; height: 21px; line-height: 21px; text-align: center; width: 21px; }
.tv-epg-theme-light .stepswoo-schedule-social-bar { background: #f3f3f3; }
.tv-epg-theme-light .stepswoo-schedule-social-action { border-left-color: #d5d5d5; color: #222; }

@media (max-width: 600px) {
    .stepswoo-schedule-social-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 5px; }
    .stepswoo-schedule-social-action { border-left: 0; border-top: 1px solid rgba(255,255,255,0.16); min-height: 42px; padding: 0 8px; }
    .stepswoo-schedule-social-action:nth-child(-n+2) { border-top: 0; }
    .tv-epg-theme-light .stepswoo-schedule-social-action { border-top-color: #d5d5d5; }
}

/* Article fact-check drawer */
.stepswoo-fact-check-backdrop { background: rgba(0,0,0,.58); inset: 0; opacity: 0; pointer-events: none; position: fixed; transition: opacity .2s ease; z-index: 99997; }
.stepswoo-fact-check-backdrop.is-open { opacity: 1; pointer-events: auto; }
.stepswoo-fact-check-panel { background: #242424; box-shadow: -10px 0 35px rgba(0,0,0,.35); color: #fff; display: flex; flex-direction: column; height: 100vh; max-width: 380px; position: fixed; right: 0; top: 0; transform: translateX(105%); transition: transform .25s ease; width: 88vw; z-index: 99998; }
.stepswoo-fact-check-panel.is-open { transform: translateX(0); }
.stepswoo-fact-check-head { align-items: center; background: #1a1a1a; border-bottom: 3px solid #f36b21; display: flex; font-size: 19px; justify-content: space-between; padding: 18px 20px; }
.stepswoo-fact-check-close { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 30px; line-height: 1; padding: 0; }
.stepswoo-fact-check-body { font-size: 15px; line-height: 1.65; overflow-y: auto; padding: 20px; }
.stepswoo-fact-check-loading { color: #f36b21; font-weight: 700; }
.stepswoo-fact-check-result { white-space: normal; }
.stepswoo-fact-check-item { border-bottom: 1px solid rgba(255,255,255,.14); margin: 0 0 16px; padding: 0 0 15px; }
.stepswoo-fact-check-item:last-child { border-bottom: 0; }
.stepswoo-fact-check-item p { margin: 8px 0; }
.stepswoo-fact-check-item a { color: #f36b21; font-weight: 700; }
.stepswoo-source-links { display: grid; gap: 10px; }
.stepswoo-source-links a { background: #f36b21; border-radius: 5px; color: #fff; display: block; font-weight: 700; padding: 12px; text-align: center; text-decoration: none; }
.stepswoo-source-links a:hover { background: #d95712; color: #fff; }
.stepswoo-fact-check-note { border-top: 1px solid rgba(255,255,255,.14); color: #bbb; font-size: 12px; margin-top: 18px; padding-top: 14px; }
.stepswoo-fact-check-error { color: #ffab91; }

/* A single channel needs only one row, not the full guide height. */
.tv-epg-single-channel { height: auto !important; }
.tv-epg-single-channel .tv-epg-grid-wrapper {
    height: auto;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
}
.tv-epg-single-channel .tv-epg-program-title {
    display: -webkit-box;
    font-size: 14px;
    line-height: 1.25;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* Themes */
.tv-epg-theme-dark {
    background: #0f1115;
    color: #e4e4e7;
}
.tv-epg-theme-light {
    background: #f8f9fa;
    color: #1a1a1a;
}

/* Header / Controls */
.tv-epg-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.tv-epg-theme-light .tv-epg-header {
    border-bottom-color: #ddd;
}

.tv-epg-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tv-epg-btn {
    background: #27272a;
    color: #e4e4e7;
    border: 1px solid #3f3f46;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.tv-epg-btn:hover {
    background: #3f3f46;
}
.tv-epg-theme-light .tv-epg-btn {
    background: #fff;
    color: #333;
    border-color: #ccc;
}
.tv-epg-theme-light .tv-epg-btn:hover {
    background: #f0f0f0;
}

.tv-epg-current-time {
    font-size: 14px;
    font-weight: 500;
    margin-left: 12px;
    opacity: 0.9;
}

/* Grid Wrapper */
.tv-epg-grid-wrapper {
    position: relative;
    height: calc(100% - 55px);
    overflow: auto;
}

.tv-epg-loading {
    padding: 40px;
    text-align: center;
    font-size: 16px;
    opacity: 0.7;
}

/* The actual grid */
.tv-epg-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    min-width: 900px;
}

/* Channel column (sticky) */
.tv-epg-channels {
    position: sticky;
    left: 0;
    z-index: 20;
    background: inherit;
}

.tv-epg-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 70px;
    padding: 0 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    border-right: 1px solid rgba(255,255,255,0.08);
    background: #18181b;
}
.tv-epg-theme-light .tv-epg-channel {
    background: #fff;
    border-bottom-color: #eee;
    border-right-color: #ddd;
}

.tv-epg-channel-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: #27272a;
}
.tv-epg-channel-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Timeline header (sticky top) */
.tv-epg-timeline {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 15;
    background: #18181b;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tv-epg-theme-light .tv-epg-timeline {
    background: #f1f3f5;
    border-bottom-color: #ddd;
}

.tv-epg-time-slot {
    flex: 0 0 180px; /* 30 min = 180px approx, adjust as needed */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    border-right: 1px solid rgba(255,255,255,0.06);
    color: #a1a1aa;
}
.tv-epg-theme-light .tv-epg-time-slot {
    border-right-color: #e5e5e5;
    color: #666;
}

/* Programs area */
.tv-epg-programs {
    position: relative;
}

.tv-epg-row {
    display: flex;
    height: 70px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
}
.tv-epg-theme-light .tv-epg-row {
    border-bottom-color: #eee;
}

.tv-epg-program {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background: #27272a;
    border-radius: 6px;
    padding: 6px 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.tv-epg-program:hover {
    background: #3f3f46;
    z-index: 5;
    transform: scale(1.01);
}
.tv-epg-theme-light .tv-epg-program {
    background: #fff;
    border-color: #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tv-epg-theme-light .tv-epg-program:hover {
    background: #f8f8f8;
    border-color: #ccc;
}

.tv-epg-program-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.tv-epg-program-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 2px;
}

/* Current time indicator */
.tv-epg-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    z-index: 10;
    pointer-events: none;
}
.tv-epg-now-line::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
}

/* Modal for program details */
.tv-epg-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.tv-epg-modal.active {
    display: flex;
}
.tv-epg-modal-content {
    background: #18181b;
    color: #e4e4e7;
    max-width: 480px;
    width: 100%;
    border-radius: 12px;
    padding: 24px;
    position: relative;
}
.tv-epg-theme-light .tv-epg-modal-content {
    background: #fff;
    color: #222;
}
.tv-epg-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}
.tv-epg-modal-close:hover {
    opacity: 1;
}
.tv-epg-modal-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
}
.tv-epg-modal-meta {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 16px;
}
.tv-epg-modal-desc {
    font-size: 14px;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .tv-epg-grid {
        grid-template-columns: 110px 1fr;
        min-width: 700px;
    }
    .tv-epg-channel {
        padding: 0 8px;
    }
    .tv-epg-channel-logo {
        width: 28px;
        height: 28px;
    }
    .tv-epg-channel-name {
        font-size: 11px;
    }
    .tv-epg-time-slot {
        flex: 0 0 140px;
        font-size: 11px;
    }
}

/* Category Filters */
.tv-epg-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.tv-epg-cat {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #a1a1aa;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.tv-epg-cat:hover {
    border-color: #fff;
    color: #fff;
}
.tv-epg-cat.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}
.tv-epg-theme-light .tv-epg-cat {
    border-color: #ccc;
    color: #555;
}
.tv-epg-theme-light .tv-epg-cat:hover {
    border-color: #333;
    color: #111;
}
.tv-epg-theme-light .tv-epg-cat.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* Category color accents on programs */
.tv-epg-program.cat-sports { border-left: 3px solid #22c55e; }
.tv-epg-program.cat-movies { border-left: 3px solid #a855f7; }
.tv-epg-program.cat-family { border-left: 3px solid #f59e0b; }
.tv-epg-program.cat-news { border-left: 3px solid #ef4444; }
.tv-epg-program.cat-drama { border-left: 3px solid #3b82f6; }
.tv-epg-program.cat-comedy { border-left: 3px solid #ec4899; }

/* Badges */
.tv-epg-badge {
    display: inline-block;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 700;
    vertical-align: middle;
}
.tv-epg-badge.new { background: #22c55e; color: #fff; }
.tv-epg-badge.live { background: #ef4444; color: #fff; }

/* Logo wrapper + fallback initials */
.tv-epg-logo-wrap {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    position: relative;
}
.tv-epg-channel-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: #27272a;
}
.tv-epg-logo-fallback {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #3b82f6;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    display: none;
}
.tv-epg-theme-light .tv-epg-channel-logo {
    background: #e5e7eb;
}
.tv-epg-theme-light .tv-epg-logo-fallback {
    background: #2563eb;
}


/* Both scrollbars 18px */
.tv-epg-grid-wrapper {
    scrollbar-width: auto;
    scrollbar-color: #777 #222;
}
.tv-epg-theme-light .tv-epg-grid-wrapper {
    scrollbar-color: #888 #e0e0e0;
}

.tv-epg-grid-wrapper::-webkit-scrollbar {
    width: 18px;   /* vertical */
    height: 18px;  /* horizontal */
}
.tv-epg-grid-wrapper::-webkit-scrollbar-track {
    background: #1f1f23;
}
.tv-epg-grid-wrapper::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 9px;
    border: 3px solid #1f1f23;
}
.tv-epg-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: #888;
}
.tv-epg-theme-light .tv-epg-grid-wrapper::-webkit-scrollbar-track {
    background: #e8e8e8;
}
.tv-epg-theme-light .tv-epg-grid-wrapper::-webkit-scrollbar-thumb {
    background: #999;
    border-color: #e8e8e8;
}
.tv-epg-theme-light .tv-epg-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Scroll left/right buttons group */
.tv-epg-scroll-btns {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
}
.tv-epg-scroll-btns .tv-epg-btn {
    min-width: 36px;
    padding: 6px 10px;
    font-size: 14px;
}

/* Keep the dark guide aligned with the StepsWoo orange and charcoal palette. */
.tv-epg-theme-dark { background: #212121; color: #ffffff; }
.tv-epg-theme-dark .tv-epg-header,
.tv-epg-theme-dark .tv-epg-channel,
.tv-epg-theme-dark .tv-epg-timeline { background: #282828; }
.tv-epg-theme-dark .tv-epg-btn { background: #f36b21; border-color: #f36b21; color: #ffffff; }
.tv-epg-theme-dark .tv-epg-btn:hover { background: #d95616; border-color: #d95616; }
.tv-epg-theme-dark .tv-epg-program { background: #343434; border-color: #454545; }
.tv-epg-theme-dark .tv-epg-program:hover { background: #404040; border-color: #f36b21; }
.tv-epg-theme-dark .tv-epg-now-line,
.tv-epg-theme-dark .tv-epg-now-line::before { background: #f36b21; }
.tv-epg-theme-dark .tv-epg-logo-fallback { background: #f36b21; }
