/* Extra frontend styles: responsive polish + CMS content + performance-friendly defaults */

/* AOS: keep layout stable before animation starts */
[data-aos] {
    pointer-events: auto;
}

:root {
    --stv-red: #f10000;
    --stv-blue: #01386b;
}

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

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

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

.site-btn-danger,
.btn.site-btn-danger {
    background: var(--stv-red);
    border-color: var(--stv-red);
    color: #fff;
}
.site-btn-danger:hover,
.btn.site-btn-danger:hover {
    background: var(--stv-blue);
    border-color: var(--stv-blue);
    color: #fff;
}

/* Horizontal news cards (home + category) */
.political-link,
.sports-link,
.latest-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.political-item,
.sports-item,
.latest-item {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: .3s;
    height: 100%;
}

.political-item:hover,
.sports-item:hover,
.latest-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, .1);
}

.political-item img,
.sports-item img,
.latest-item img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.political-content h6,
.sports-content h6,
.latest-content h6 {
    font-size: 14px;
    margin: 0 0 4px;
    line-height: 1.35;
}

/* Video popup */
.news-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.news-popup .popup-content {
    position: relative;
    width: min(900px, 100%);
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.news-popup iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    display: block;
}

.news-popup .popup-close {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 2;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

/* Magazine cards */
.magazine-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, .08);
}

/* CMS article body — prevent overflow on mobile */
.article-body {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.7;
}

.article-body img,
.article-body video,
.article-body iframe {
    max-width: 100% !important;
    height: auto !important;
}

.article-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-body pre {
    white-space: pre-wrap;
    overflow-x: auto;
}

/* Main content breathing room above fixed mobile widgets */
main {
    padding-bottom: 1rem;
}

/* =========================
   Responsive — tablet/phone
   ========================= */
@media (max-width: 991.98px) {
    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .live-tv-floating {
        right: 12px;
        bottom: 84px;
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 767.98px) {
    .header-container {
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-box {
        order: 3;
        width: 100%;
    }

    .flash-bar {
        height: auto !important;
        flex-wrap: wrap;
        align-items: stretch;
        margin-top: 10px;
    }

    .flash-title {
        width: 100%;
        text-align: center;
        padding: 8px 12px;
        font-size: 13px;
    }

    .flash-marquee {
        width: 100%;
        font-size: 13px;
        order: 2;
    }

    .flash-marquee marquee {
        line-height: 36px;
    }

    .date-time {
        width: 100%;
        justify-content: center;
        gap: 10px;
        padding: 6px 10px 8px;
        font-size: 12px;
        order: 3;
        border-top: 1px solid rgba(255, 255, 255, .12);
    }

    .political-item img,
    .sports-item img,
    .latest-item img {
        width: 96px;
        height: 64px;
    }

    .carousel-caption h3 {
        font-size: 1rem;
    }

    .carousel-caption p {
        font-size: .85rem;
        margin-bottom: .25rem;
    }

    /* Social bar: bottom strip — leave room for content */
    .social-sidebar {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        transform: none !important;
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 0;
        z-index: 1040;
        background: rgba(1, 56, 107, .96);
        padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .social-sidebar a {
        width: 44px;
        height: 44px;
        margin: 0 4px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .live-tv-floating {
        bottom: calc(62px + env(safe-area-inset-bottom, 0px));
        right: 10px;
        font-size: 12px;
        padding: 8px 10px;
    }

    main {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }

    .news-menu .menu-toggle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        padding: 10px;
    }

    .history-section,
    .py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .footer-grid,
    .footer .row {
        row-gap: 1rem;
    }

    form .btn,
    .btn {
        min-height: 42px;
    }

    input,
    select,
    textarea {
        font-size: 16px !important; /* prevent iOS zoom */
    }
}

@media (max-width: 575.98px) {
    .political-item,
    .sports-item,
    .latest-item {
        gap: 8px;
        padding: 8px;
    }

    .political-content h6,
    .sports-content h6,
    .latest-content h6 {
        font-size: 13px;
    }

    .carousel-caption {
        left: 8%;
        right: 8%;
        bottom: 8px;
        padding: 6px;
    }

    .live-tv-floating {
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }
}

/* Prefer reduced motion for accessibility / battery */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .live-tv-floating,
    .live-dot,
    [data-aos] {
        animation: none !important;
        transition: none !important;
    }
}
