/* ============================================================
   news.css — News feature page styles
   All custom styles for news/index.php.
   Bootstrap 5 utility classes are used directly in HTML.
   Do NOT import this file into any other page.
   ============================================================ */


/* ── 1. Search bar ──────────────────────────────────────────
   Pill-shaped input group; icon on the left, text on the right.
   Focus state switches the border to the theme purple.
   ─────────────────────────────────────────────────────────── */

.news-search-bar .input-group-text {
    background: #fff;
    border-right: none;
    border-radius: 25px 0 0 25px !important;
    color: #9ca3af;
    border-color: #e5e7eb;
}

.news-search-bar .form-control {
    border-left: none;
    border-radius: 0 25px 25px 0 !important;
    border-color: #e5e7eb;
    font-size: 14px;
}

.news-search-bar .form-control:focus {
    box-shadow: none;
    border-color: #764ba2;
}

.news-search-bar:focus-within .input-group-text {
    border-color: #764ba2;
}


/* ── 2. Category pill filters ───────────────────────────────
   Horizontally scrollable row of rounded pill buttons.
   Each pill shows a coloured gradient when active and a
   light-grey outline when inactive.
   ─────────────────────────────────────────────────────────── */

.news-pills-wrapper {
    position: relative;
    padding: 4px 16px 12px;
}

.news-pills-wrapper::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 16px;
    width: 38px;
    height: calc(100% - 16px);
    pointer-events: none;
    background: linear-gradient(to right, rgba(248, 249, 250, 0), #f8f9fa 76%);
}

.news-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    padding-right: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;           /* Firefox */
}
.news-pills::-webkit-scrollbar { display: none; }  /* Chrome / Safari */

.news-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid #dee2e6;
    background: #fff;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.news-pill:last-child {
    padding-right: 26px;
}

.news-pill:hover:not(.active) {
    border-color: #adb5bd;
    background: #f8f9fa;
}

/* "All" → theme purple gradient */
.news-pill[data-category="all"].active {
    background: linear-gradient(to right, #667eea, #764ba2);
    border-color: transparent;
    color: #fff;
}

/* Adverts → warm amber */
.news-pill[data-category="advert"].active {
    background: linear-gradient(135deg, #f6d365, #fda085);
    border-color: transparent;
    color: #6b2e00;
}

/* Directives → bold red */
.news-pill[data-category="directive"].active {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-color: transparent;
    color: #fff;
}

/* General → sky blue */
.news-pill[data-category="general"].active {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    border-color: transparent;
    color: #003d5c;
}


/* ── 3. Hero / featured card ────────────────────────────────
   Full-width gradient card at the top of the list.
   Purple gradient matches the shared app theme.
   Subtle diagonal shimmer streak for depth.
   ─────────────────────────────────────────────────────────── */

.news-hero {
    background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px 18px 18px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-hero:hover,
.news-hero:focus {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(102, 126, 234, 0.55);
    outline: none;
}

/* Diagonal shimmer streak — decorative light sweep */
.news-hero::before {
    content: "";
    position: absolute;
    top: -40%;
    left: -25%;
    width: 28%;
    height: 180%;
    background: rgba(255, 255, 255, 0.09);
    transform: rotate(28deg);
    pointer-events: none;
}

/* Unread dot on hero: white pulse in top-right corner */
.news-hero .unread-dot {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    animation: pulseUnread 2s ease-in-out infinite;
}

.news-hero-badge { margin-bottom: 10px; }

.news-hero-title {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.45;
}

.news-hero-summary {
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    margin: 0 0 16px;
    line-height: 1.55;
}

.news-hero-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-hero-author {
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
}

/* "Read more" button on the hero card.
   pointer-events: none because the whole hero div handles the click. */
.news-hero-read-btn {
    background: rgba(255, 255, 255, 0.18);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    color: #fff;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    cursor: pointer;
}


/* ── 4. Category badges (pill-shaped) ───────────────────────
   Small pill badges used inside both the hero and regular cards.
   The hero variant uses a glass-white style to stay legible on
   the purple gradient; regular cards use coloured tints.
   ─────────────────────────────────────────────────────────── */

.news-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Hero card badge — glass white (same for all categories on gradient bg) */
.news-badge-hero {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* Regular card badges — tinted to match their category color */
.news-badge-advert    { background: #fff3cd; color: #855500; }
.news-badge-directive { background: #fde8e8; color: #c0392b; }
.news-badge-general   { background: #dbeafe; color: #1e40af; }


/* ── 5. Regular news cards ──────────────────────────────────
   White cards with a thick left-border accent colored by category.
   Slight hover lift effect lifts the card on cursor entry.
   The border-left drives the visual differentiation; all other
   borders are suppressed so only the accent shows.
   ─────────────────────────────────────────────────────────── */

.news-card {
    background: #fff;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Left-border accent — individual color set per class below */
    border-left:   5px solid transparent !important;
    border-top:    none !important;
    border-right:  none !important;
    border-bottom: none !important;
}

.news-card:hover,
.news-card:focus {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.11);
    outline: none;
}

/* Left-border accent colors by category */
.news-card.card-directive { border-left-color: #e74c3c !important; }
.news-card.card-advert    { border-left-color: #f39c12 !important; }
.news-card.card-general   { border-left-color: #2980b9 !important; }

/* Truncate summary to one line */
.news-card-headline {
    font-size: 14px;
    line-height: 1.4;
    color: #1a1a2e;
}

.news-card-summary {
    font-size: 12px;
    line-height: 1.5;
    color: #6c757d;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
}

.news-card-date      { font-size: 11px; white-space: nowrap; }
.news-card-read-link { font-size: 11px; font-weight: 600; color: #667eea; }


/* ── 6. Unread indicator dot ────────────────────────────────
   Small filled dot in the top-right corner of each card or hero.
   Removed from the DOM once openNewsSheet() marks the item read.
   ─────────────────────────────────────────────────────────── */

.news-card .unread-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: pulseUnread 2s ease-in-out infinite;
}

/* Shared pulse animation used by both card and hero unread dots */
@keyframes pulseUnread {
    0%, 100% { opacity: 1;   transform: scale(1);   }
    50%       { opacity: 0.6; transform: scale(1.25); }
}


/* ── 7. Empty state ─────────────────────────────────────────
   Shown when no news items match the current filter + search.
   Centred illustration: icon circle + heading + helper text.
   ─────────────────────────────────────────────────────────── */

.news-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.news-empty-icon {
    width: 68px;
    height: 68px;
    background: #f3f0ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #667eea;
    margin-bottom: 16px;
}

.news-empty h6 {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.news-empty p {
    font-size: 13px;
    color: #adb5bd;
    line-height: 1.5;
    margin: 0;
}


/* ── 8. Bottom-sheet overlay ────────────────────────────────
   Semi-transparent dark backdrop behind the sheet.
   Fades in when the sheet opens; hidden by default.
   Clicking it triggers closeNewsSheet().
   ─────────────────────────────────────────────────────────── */

.news-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.48);
    z-index: 2040;
    opacity: 0;
    pointer-events: none;
}

.news-overlay.active {
    display: block;
    animation: fadeInOverlay 0.25s ease forwards;
    pointer-events: auto;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}


/* ── 9. Bottom-sheet panel ──────────────────────────────────
   Slides up from the bottom to cover 80% of the screen.
   Animated via CSS transform (translateY) on class toggle.
   Contains a drag handle, a meta row, and a scrollable body.
   ─────────────────────────────────────────────────────────── */

.news-sheet {
    position: fixed;
    background: #fff;
    z-index: 2050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
}

.news-sheet.open {
    pointer-events: auto;
}

.news-sheet.mode-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    height: 80%;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.18);
}

/* Adding .open slides the panel into view */
.news-sheet.mode-sheet.open {
    transform: translateY(0);
}

/* Drag handle — visual affordance at the top of the sheet */
.news-sheet-drag-handle {
    width: 36px;
    height: 4px;
    background: #dee2e6;
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

/* Meta row: badge + date on the left, close button on the right */
.news-sheet-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 16px 6px;
    flex-shrink: 0;
}

.news-sheet-close-btn {
    background: #f1f3f5;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    color: #495057;
    flex-shrink: 0;
    margin-left: 8px;
    transition: background 0.2s;
}

.news-sheet-close-btn:hover { background: #dee2e6; }

/* Scrollable article body */
.news-sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 20px 32px;
    -webkit-overflow-scrolling: touch;
}

.news-sheet-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.45;
    margin-bottom: 14px;
    padding-top: 4px;
}

.news-sheet-content {
    font-size: 14px;
    line-height: 1.8;
    color: #444;
    margin-bottom: 0;
}

/* Author row — separator line + icon + name at the bottom */
.news-sheet-author-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid #f1f3f5;
    font-size: 13px;
    color: #888;
}


/* ── 10. Responsive — constrain sheet on larger screens ─────
   On viewports wider than 600px, cap the sheet at phone width
   and centre it horizontally so it matches the app frame.
   ─────────────────────────────────────────────────────────── */

@media (min-width: 768px) {
    .news-overlay.mode-modal.active {
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .news-sheet.mode-modal {
        left: 50%;
        top: 50%;
        width: min(520px, calc(100% - 32px));
        max-height: 75vh;
        border-radius: 16px;
        box-shadow: 0 24px 64px rgba(15, 23, 42, 0.36);
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    .news-sheet.mode-modal.open {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    .news-sheet.mode-modal .news-sheet-drag-handle {
        display: none;
    }

    .news-sheet.mode-modal .news-sheet-top {
        padding: 16px 20px 8px;
    }

    .news-sheet.mode-modal .news-sheet-body {
        padding: 4px 20px 24px;
    }
}


/* ── 11. News-page slider / carousel ────────────────────────
   Horizontal auto-advancing image slider that sits at the top
   of the News page.  Each slide opens the shared news modal
   (defined above in sections 8–10) on tap/click.
   ─────────────────────────────────────────────────────────── */

.news-slider-section {
    margin-bottom: 4px;
}

.news-slider-shell {
    background: #060b12;
    border-radius: 18px;
    overflow: hidden;
    padding: 14px 0 12px;
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.32);
}

.news-slider-viewport {
    overflow: hidden;
    padding-left: 12px;
    touch-action: pan-y;
}

.news-slider-track {
    display: flex;
    gap: 12px;
    will-change: transform;
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.news-slider-slide {
    flex: 0 0 min(calc((100% - 12px) / 1.25), 760px);
    max-width: min(calc((100% - 12px) / 1.25), 760px);
    border: 0;
    padding: 0;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    text-align: left;
}

.news-slider-slide:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.9);
    outline-offset: 2px;
}

.news-slider-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.news-slider-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-slider-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(4, 9, 18, 0.84) 0%, rgba(4, 9, 18, 0.06) 58%);
}

.news-slider-slide[data-category="advert"] .news-slider-gradient {
    background: linear-gradient(to top, rgba(95, 49, 10, 0.82) 0%, rgba(95, 49, 10, 0.05) 58%);
}

.news-slider-slide[data-category="directive"] .news-slider-gradient {
    background: linear-gradient(to top, rgba(113, 24, 24, 0.82) 0%, rgba(113, 24, 24, 0.05) 58%);
}

.news-slider-slide[data-category="general"] .news-slider-gradient {
    background: linear-gradient(to top, rgba(15, 40, 86, 0.82) 0%, rgba(15, 40, 86, 0.05) 58%);
}

.news-slider-caption {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    color: #fff;
    z-index: 2;
}

.news-slider-caption-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.news-slider-caption-desc {
    margin: 5px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-slider-dots {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 8px;
}

.news-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.news-slider-dot.active {
    background: #22c55e;
    transform: scale(1.1);
}

/* Image shown inside the news modal when opened from a slider slide */
.news-slider-modal-image-wrap {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
    max-height: 230px;
}

.news-slider-modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-slider-modal-lead {
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 10px;
}
