/* =========================================
   ROOT VARIABLES & RESET
   ========================================= */
:root {
    --primary: #DC143C;
    --primary-dark: #b01030;
    --primary-light: #ff1a4d;
    --success: #10b981;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --white: #ffffff;
    --gray: #6b7280;
    --gray-light: #e5e7eb;
    --border: #e5e7eb;
    --shadow: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-hover: 0 8px 20px rgba(0,0,0,0.08);
    --font-en: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-np: 'Mukta', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-en);
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.5;
    overflow-x: hidden;
    font-size: 15px;
}

body.lang-np { font-family: var(--font-np); }

a { text-decoration: none; color: inherit; transition: var(--transition); }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
img { max-width: 100%; height: auto; }

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   2. HEADER (Compact)
   ========================================= */
.main-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 10px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo-area h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin: 0;
}

.logo-area .highlight { color: var(--primary); }

.logo-area .tagline {
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 2px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    justify-content: flex-end;
    width: 100%;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--light);
    border-radius: 20px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 260px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.08);
}

.search-box input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 4px 6px;
    font-size: 0.85rem;
    outline: none;
    color: var(--dark);
}

.search-box button {
    background: transparent;
    color: var(--gray);
    font-size: 0.95rem;
    padding: 0 4px;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-select {
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    background: var(--white);
    cursor: pointer;
    font-weight: 500;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.75rem;
    user-select: none;
    white-space: nowrap;
}

.toggle-switch input { display: none; }

.slider {
    width: 36px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    transition: var(--transition);
}

.slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(16px); }

.label-text {
    font-weight: 600;
    color: var(--gray);
    display: none;
}

.icon-btn {
    background: var(--light);
    color: var(--dark);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    border: 1px solid var(--border);
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.bookmark-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    border: 2px solid var(--white);
    min-width: 18px;
    text-align: center;
    line-height: 1;
    z-index: 2;
}

@media (min-width: 768px) {
    .header-content { flex-wrap: nowrap; }
    .header-actions { width: auto; }
    .search-box { width: 280px; }
    .label-text { display: inline; }
    .logo-area h1 { font-size: 1.6rem; }
}

/* =========================================
   3. TICKER
   ========================================= */
.ticker-wrap {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
    overflow: hidden;
    height: 40px;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.ticker-container {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 20px;
}

.ticker-label {
    background: rgba(0,0,0,0.25);
    padding: 5px 10px;
    border-radius: 5px;
    margin-right: 12px;
    white-space: nowrap;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    font-weight: 700;
}

.ticker-move {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: scroll 28s linear infinite;
    flex-grow: 1;
}

.ticker-wrap:hover .ticker-move { animation-play-state: paused; }

@keyframes scroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* =========================================
   4. FILTERS & SORT CONTROLS
   ========================================= */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 0;
}

.filters-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--light);
    flex-grow: 1;
}

.filters-scroll::-webkit-scrollbar { height: 5px; }

.filter-btn {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
    white-space: nowrap;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.filter-btn:hover {
    background: #f1f1f1;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(220, 20, 60, 0.3);
}

.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray);
}

.sort-dropdown select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 0.8rem;
    background: var(--white);
    cursor: pointer;
    font-weight: 500;
    color: var(--dark);
}

/* =========================================
   5. BANNERS & ADS
   ========================================= */
.banner-container {
    margin: 20px 0;
    text-align: center;
    min-height: 90px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
    border: 1px dashed var(--border);
}

.banner-container img {
    max-width: 100%;
    max-height: 90px;
    object-fit: contain;
    border-radius: 6px;
}

.ad-slot {
    background: #f9fafb;
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin: 20px 0;
    padding: 15px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-slot-label {
    font-size: 0.7rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

/* =========================================
   6. NEWS GRID & CARDS
   ========================================= */
.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    padding-bottom: 40px;
}

@media (min-width: 640px) { .news-grid { grid-template-columns: repeat(2, 1fr); gap: 22px; } }
@media (min-width: 1024px) { .news-grid { grid-template-columns: repeat(3, 1fr); gap: 28px; } }

.news-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
    height: 100%;
    box-shadow: var(--shadow);
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.card-bookmark {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.98);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: var(--transition);
    font-size: 0.9rem;
    border: 1px solid var(--border);
}

.card-bookmark:hover,
.card-bookmark.active {
    color: var(--primary);
    background: white;
    transform: scale(1.08);
    border-color: var(--primary);
}

.card-image-wrapper {
    width: 100%;
    padding-top: 50%;
    position: relative;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    overflow: hidden;
}

.card-image-wrapper img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.card-image-wrapper img:hover {
    transform: scale(1.03);
    transition: transform 0.3s ease;
}

.data-saver-on .card-image-wrapper { display: none; }

.card-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.card-category {
    color: var(--primary);
    background: rgba(220, 20, 60, 0.06);
    padding: 2px 6px;
    border-radius: 3px;
}

.card-time { color: var(--gray); font-weight: 500; }

.card-source {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: var(--gray);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.card-source i { color: var(--primary); font-size: 0.65rem; }

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.35;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: var(--transition);
}

.news-card:hover .card-title { color: var(--primary); }

.card-summary {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    line-height: 1.5;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: auto;
}

.reaction-group { display: flex; gap: 8px; }

.react-btn {
    background: transparent;
    font-size: 1.1rem;
    opacity: 0.55;
    transition: var(--transition);
    cursor: pointer;
    padding: 0;
    position: relative;
}

.react-btn:hover,
.react-btn.voted { opacity: 1; transform: scale(1.2); }

.react-btn.voted::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.share-btn {
    color: var(--primary);
    font-size: 0.95rem;
    cursor: pointer;
    opacity: 0.75;
    background: none;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
}

.share-btn:hover { opacity: 1; background: rgba(220, 20, 60, 0.08); }

.read-more {
    display: block;
    background: linear-gradient(135deg, var(--dark), #374151);
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 0.8rem;
    margin-top: 10px;
    transition: var(--transition);
    letter-spacing: 0.2px;
}

.read-more:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(220, 20, 60, 0.25);
}

/* =========================================
   7. FLOATING TRENDING BUTTON
   ========================================= */
.floating-trending {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(220, 20, 60, 0.4);
    z-index: 999;
    transition: var(--transition);
    animation: float 3s ease-in-out infinite;
    border: 2px solid white;
}

.floating-trending:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 25px rgba(220, 20, 60, 0.5);
}

.floating-trending .badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--warning);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.trending-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.65);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.trending-modal {
    background: white;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 16px;
    overflow: hidden;
    animation: slideUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.trending-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trending-header h3 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }

.trending-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.trending-header button:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.trending-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.trending-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.trending-item:hover {
    background: var(--light);
    padding-left: 8px;
    border-radius: 6px;
}

.trending-item:last-child { border-bottom: none; }

.trending-rank {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.trending-info h4 {
    font-size: 0.9rem;
    margin: 0 0 4px 0;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trending-info p { font-size: 0.75rem; color: var(--gray); margin: 0; }

/* =========================================
   8. UTILITIES & MODALS
   ========================================= */
.loading-state,
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--gray);
}

.loading-state i { font-size: 2.2rem; margin-bottom: 12px; color: var(--primary); }
.empty-state i { font-size: 3.5rem; margin-bottom: 18px; opacity: 0.2; }
.empty-state h3 { margin-bottom: 6px; color: var(--dark); font-size: 1.2rem; }
.empty-state p { color: var(--gray); font-size: 0.9rem; }

footer {
    background: var(--dark);
    color: #9ca3af;
    padding: 40px 0 20px;
    margin-top: 50px;
    border-top: 3px solid var(--primary);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 20px;
    border-bottom: 1px solid #374151;
    padding-bottom: 20px;
}

.footer-brand h4 { color: white; margin-bottom: 6px; font-size: 1.1rem; }
.footer-brand p { font-size: 0.85rem; line-height: 1.5; }
.footer-links a { margin-left: 18px; font-size: 0.85rem; transition: var(--transition); }
.footer-links a:hover { color: white; padding-left: 4px; }
.copyright { text-align: center; font-size: 0.8rem; color: #6b7280; }

.share-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.65);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.share-modal {
    background: white;
    padding: 26px;
    border-radius: 14px;
    width: 90%;
    max-width: 360px;
    animation: slideUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--light);
    padding-bottom: 12px;
}

.share-header h3 { font-size: 1.1rem; margin: 0; color: var(--dark); }
.share-header button {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--gray);
    transition: var(--transition);
    line-height: 1;
}
.share-header button:hover { color: var(--primary); transform: rotate(90deg); }
.share-options { display: flex; flex-direction: column; gap: 8px; }
.share-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--light);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    text-align: left;
    width: 100%;
    color: var(--dark);
    font-weight: 500;
}
.share-option:hover { background: #e5e7eb; transform: translateX(6px); }
.share-option i { width: 22px; text-align: center; color: var(--primary); font-size: 1.1rem; }
.share-dropdown { position: relative; margin-top: 6px; }
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%; left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;
    width: 100%;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    z-index: 10;
    overflow: hidden;
}
.share-dropdown:hover .dropdown-content { display: block; }
.dropdown-content a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--dark);
    font-size: 0.9rem;
    transition: var(--transition);
    font-weight: 500;
}
.dropdown-content a:hover { background: var(--light); padding-left: 22px; color: var(--primary); }

.lang-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 6px;
}
.lang-badge.np { background: #dbeafe; color: #1e40af; }
.lang-badge.en { background: #dcfce7; color: #166534; }

@media (max-width: 640px) {
    .header-content { flex-direction: column; align-items: stretch; }
    .header-actions { justify-content: space-between; margin-top: 10px; }
    .search-box { width: 100%; max-width: none; }
    .controls-group { justify-content: space-between; flex-grow: 1; }
    .label-text { display: none; }
    .news-grid { gap: 14px; }
    .card-content { padding: 12px; }
    .card-title { font-size: 0.9rem; }
    .controls-bar { flex-direction: column; align-items: stretch; }
    .sort-dropdown { justify-content: space-between; }
    .floating-trending { bottom: 20px; right: 20px; width: 50px; height: 50px; font-size: 1.2rem; }
}

@media print {
    .main-header, .ticker-wrap, .filters-scroll, .card-actions, footer, .floating-trending { display: none !important; }
    .news-grid { display: block; }
    .news-card { break-inside: avoid; margin-bottom: 18px; box-shadow: none; border: 1px solid #000; }
}