/* ===========================================
   MOBILE RESPONSIVE STYLES
   ArkforgeAI.com - Newsource
   =========================================== */

/* =============== MOBILE SIDEBAR (Word Filter) =============== */
/* Toggle button for mobile sidebar */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 8px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.mobile-sidebar-toggle:hover {
    padding-left: 12px;
}

.mobile-sidebar-toggle .toggle-icon {
    display: block;
    transition: transform 0.3s ease;
}

.mobile-sidebar-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

/* Overlay for when sidebar is open */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Hide nav labels on desktop - only show on mobile */
.nav-label {
    display: none;
}

/* Mobile Stats Section - hidden on desktop */
.mobile-stats-section {
    display: none;
}

/* Mobile Articles List - hidden on desktop, shown on mobile */
.mobile-articles-list {
    display: none;
}

/* =============== TABLET BREAKPOINT (1024px) =============== */
@media (max-width: 1024px) {
    /* Show mobile sidebar toggle */
    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Word Cloud Sidebar - Hidden by default, full screen overlay */
    .word-cloud-sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        z-index: 10000 !important;
        padding: 0 !important;
        overflow: hidden !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
        background: white !important;
        display: flex;
        flex-direction: column;
        margin: 0 !important;
    }

    .word-cloud-sidebar.active {
        transform: translateX(0);
    }

    /* Header styling for mobile */
    .word-cloud-sidebar .sidebar-header {
        position: sticky;
        top: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding: 20px;
        padding-right: 60px;
        border-bottom: none;
        z-index: 10;
        flex-shrink: 0;
    }

    .word-cloud-sidebar .sidebar-header h3 {
        color: white !important;
        font-size: 1.4rem;
        font-weight: 700;
        margin: 0;
    }

    .word-cloud-sidebar .sidebar-header .clear-btn {
        background: rgba(255, 255, 255, 0.2) !important;
        color: white !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.85rem;
        margin-top: 10px;
    }

    /* Selected words styling */
    .word-cloud-sidebar .selected-words {
        background: #f8f9fa;
        padding: 15px 20px;
        border-bottom: 1px solid #e5e7eb;
        flex-shrink: 0;
    }

    .word-cloud-sidebar .selected-words p {
        color: #6b7280 !important;
        font-size: 0.85rem;
        margin-bottom: 10px;
        font-weight: 600;
    }

    .word-cloud-sidebar .selected-word {
        background: #667eea !important;
        color: white !important;
        padding: 6px 14px;
        border-radius: 20px;
        font-weight: 600;
        margin: 3px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 0.9rem;
    }

    .word-cloud-sidebar .selected-word .remove-word {
        background: rgba(255, 255, 255, 0.3);
        color: white;
        border: none;
        border-radius: 50%;
        width: 20px;
        height: 20px;
        font-size: 14px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    /* Word cloud container - the magic happens here */
    .word-cloud-sidebar .word-cloud {
        flex: 1;
        padding: 20px;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: center;
        align-content: flex-start;
        gap: 10px;
        overflow-y: auto;
        background: white;
    }

    /* Word tags - pill buttons with original colors */
    .word-cloud-sidebar .word-tag {
        background: #f3f4f6 !important;
        border-radius: 20px !important;
        padding: 10px 18px !important;
        font-weight: 600 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease !important;
        border: 2px solid transparent !important;
        font-size: 0.95rem !important;
    }

    .word-cloud-sidebar .word-tag:hover {
        transform: scale(1.05) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    }

    .word-cloud-sidebar .word-tag.active {
        background: #667eea !important;
        color: white !important;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
        transform: scale(1.05) !important;
    }

    /* Word cloud info - hide color guide, keep tips minimal */
    .word-cloud-sidebar .word-cloud-info {
        background: #f8f9fa;
        padding: 15px 20px;
        border-top: 1px solid #e5e7eb;
        flex-shrink: 0;
    }

    .word-cloud-sidebar .word-cloud-info p {
        color: #6b7280 !important;
        font-size: 0.85rem;
        text-align: center;
        margin: 4px 0;
    }

    .word-cloud-sidebar .word-cloud-info details {
        display: none !important;
    }

    /* =============== MOBILE ARTICLES LIST =============== */
    /* Hide desktop grouped sections on mobile */
    .bias-sections.desktop-only {
        display: none !important;
    }

    /* Show mobile interleaved list */
    .mobile-articles-list {
        display: block !important;
        padding: 15px;
    }

    .mobile-articles-list > h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
        color: #1f2937;
    }

    .mobile-articles-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-article-card {
        display: flex;
        background: white;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        border: 1px solid #e5e7eb;
    }

    .mobile-article-bias-bar {
        width: 4px;
        flex-shrink: 0;
    }

    .mobile-article-bias-bar.left {
        background: #2563eb;
    }

    .mobile-article-bias-bar.center {
        background: #9ca3af;
    }

    .mobile-article-bias-bar.right {
        background: #dc2626;
    }

    .mobile-article-content {
        display: flex;
        flex: 1;
        padding: 12px;
        gap: 12px;
    }

    .mobile-article-image {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
        border-radius: 8px;
        overflow: hidden;
    }

    .mobile-article-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .mobile-article-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .mobile-article-source {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .mobile-article-source .source-name {
        font-size: 0.8rem;
        color: #6b7280;
        font-weight: 500;
    }

    .mobile-article-source .bias-pill {
        font-size: 0.65rem;
        padding: 2px 8px;
        border-radius: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .bias-pill.left {
        background: #dbeafe;
        color: #1d4ed8;
    }

    .bias-pill.center {
        background: #f3f4f6;
        color: #6b7280;
    }

    .bias-pill.right {
        background: #fee2e2;
        color: #dc2626;
    }

    .mobile-article-info h3 {
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.3;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .mobile-article-info h3 a {
        color: #1f2937;
        text-decoration: none;
    }

    .mobile-article-meta {
        font-size: 0.75rem;
        color: #9ca3af;
    }

    /* Close button for mobile sidebar */
    .word-cloud-sidebar .sidebar-close-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        border-radius: 50%;
        color: white;
        font-size: 24px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        padding: 0;
        z-index: 12;
    }

    .word-cloud-sidebar .sidebar-close-btn:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    /* Hide close button on desktop */
    @media (min-width: 1025px) {
        .word-cloud-sidebar .sidebar-close-btn {
            display: none;
        }
    }

    /* Remove left margin from all sections */
    .navbar .container {
        max-width: 100%;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0 15px;
    }

    .carousel-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 0;
        margin-top: 0;
        height: auto;
        min-height: 300px;
    }

    .carousel-article-item {
        min-height: 280px;
    }

    .stats-bar {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .top-contributors-section {
        margin-left: 0;
        margin-right: 0;
        padding: 0 15px;
    }

    .bias-sections {
        margin-left: 0;
        margin-right: 0;
        padding: 0 15px;
    }

    /* Navbar adjustments - use hamburger menu on tablet too */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Hide desktop nav links on tablet, use hamburger menu */
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        flex-direction: column;
        justify-content: flex-start;
        padding: 80px 20px 20px;
        gap: 0;
        z-index: 9999;
        overflow-y: auto;
    }

    .nav-links.active {
        display: flex;
    }

    /* Nav link styles for tablet menu */
    .nav-links > a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 1rem;
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
        font-size: 1.1rem;
        color: #1f2937 !important;
        background: white;
    }

    .nav-links > a:hover {
        background: #f3f4f6;
    }

    /* Show nav labels in tablet menu */
    .nav-label {
        display: inline !important;
        font-size: 1rem;
        margin-left: 0.5rem;
    }

    /* Mega dropdown in tablet */
    .nav-mega-dropdown {
        width: 100%;
        flex: none;
        background: white;
    }

    .nav-mega-toggle {
        width: 100%;
        padding: 1rem;
        text-align: left;
        justify-content: flex-start;
        border-bottom: 1px solid #e5e7eb;
        border-radius: 0;
        font-size: 1.1rem;
        color: #1f2937 !important;
        background: white !important;
    }

    .nav-mega-toggle:hover {
        background: #f3f4f6 !important;
        transform: none;
    }

    .nav-mega-toggle::after {
        display: none;
    }

    .nav-mega-menu {
        position: static;
        transform: none;
        min-width: 100%;
        max-width: 100%;
        margin-top: 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
        background: #f9fafb;
        display: none;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .nav-mega-menu.show {
        display: block !important;
    }

    .nav-mega-menu::before {
        display: none;
    }

    .mega-menu-container {
        padding: 1rem;
    }

    .mega-menu-section h4 {
        color: #667eea;
        font-size: 0.9rem;
    }

    .mega-menu-grid {
        grid-template-columns: 1fr;
    }

    .mega-menu-grid a {
        padding: 0.75rem 1rem;
        padding-left: 2rem;
        color: #374151 !important;
        background: white;
        margin-bottom: 0.25rem;
        border-radius: 6px;
    }

    .mega-menu-grid a:hover {
        background: #e5e7eb;
        color: #667eea !important;
    }

    /* Contributors grid */
    .contributors-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Articles grid */
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============== MOBILE BREAKPOINT (768px) =============== */
@media (max-width: 768px) {
    /* Hide Top Contributing Sources on mobile */
    .top-contributors-section {
        display: none !important;
    }

    /* Hide stats bar on mobile - moved to hamburger menu */
    .stats-bar {
        display: none !important;
    }

    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Hide desktop nav links, show as mobile menu */
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        flex-direction: column;
        justify-content: flex-start;
        padding: 80px 20px 20px;
        gap: 0;
        z-index: 9999;
        overflow-y: auto;
    }

    .nav-links.active {
        display: flex;
    }

    /* Show nav labels on mobile */
    .nav-label {
        display: inline !important;
        font-size: 1rem;
        margin-left: 0.5rem;
    }

    /* Mobile Stats Section - show on mobile */
    .mobile-stats-section {
        display: block;
        width: 100%;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 2px solid #e5e7eb;
    }

    .mobile-stats-header {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        font-weight: 600;
        color: #667eea;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        background: #f3f4f6;
    }

    .mobile-stats-section a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 1rem;
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
        font-size: 1.1rem;
        color: #1f2937 !important;
        background: white;
        text-decoration: none;
    }

    .mobile-stats-section a:hover {
        background: #f3f4f6;
    }

    /* Mobile nav link styles */
    .nav-links > a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 1rem;
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
        font-size: 1.1rem;
        color: #1f2937 !important;
        background: white;
    }

    .nav-links > a:nth-child(1),
    .nav-links > a:nth-child(2),
    .nav-links > a:nth-child(3),
    .nav-links > a:nth-child(4) {
        font-size: 1.3rem;
    }

    .nav-links > a:hover {
        background: #f3f4f6;
    }

    /* Mega dropdown in mobile */
    .nav-mega-dropdown {
        width: 100%;
        flex: none;
        background: white;
    }

    .nav-mega-toggle {
        width: 100%;
        padding: 1rem;
        text-align: left;
        justify-content: flex-start;
        border-bottom: 1px solid #e5e7eb;
        border-radius: 0;
        font-size: 1.1rem;
        color: #1f2937 !important;
        background: white !important;
    }

    .nav-mega-toggle:hover {
        background: #f3f4f6 !important;
        transform: none;
    }

    .nav-mega-toggle::after {
        display: none;
    }

    .nav-mega-menu {
        position: static;
        transform: none;
        min-width: 100%;
        max-width: 100%;
        margin-top: 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
        background: #f9fafb;
        display: none;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .nav-mega-menu.show {
        display: block !important;
    }

    .nav-mega-menu::before {
        display: none;
    }

    .mega-menu-container {
        padding: 1rem;
    }

    .mega-menu-section h4 {
        color: #667eea;
        font-size: 0.9rem;
    }

    .mega-menu-grid {
        grid-template-columns: 1fr;
    }

    .mega-menu-grid a {
        padding: 0.75rem 1rem;
        padding-left: 2rem;
        color: #374151 !important;
        background: white;
        margin-bottom: 0.25rem;
        border-radius: 6px;
    }

    .mega-menu-grid a:hover {
        background: #e5e7eb;
        color: #667eea !important;
    }

    /* Logo adjustments */
    .logo {
        font-size: 0.9rem;
    }

    .logo span {
        display: none;
    }

    .logo-img {
        height: 35px;
    }

    /* Navbar container */
    .navbar .container {
        padding: 0 10px;
    }

    /* Stats bar */
    .stats-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 10px;
        font-size: 0.8rem;
    }

    .stats-bar span,
    .stats-bar a span {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Contributors grid */
    .contributors-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .contributor-card a {
        padding: 1rem;
    }

    .contributor-rank {
        font-size: 1.5rem;
    }

    .contributor-flag {
        font-size: 2rem;
    }

    .contributor-name {
        font-size: 0.95rem;
        min-height: auto;
    }

    /* Section headers */
    .top-contributors-section .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .top-contributors-section h2 {
        font-size: 1.4rem;
    }

    .view-more-btn {
        width: 100%;
        text-align: center;
    }

    /* Articles grid - single column */
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .article-image {
        height: 180px;
    }

    .article-content {
        padding: 1rem;
    }

    .article-card h3 {
        font-size: 1rem;
    }

    /* Bias section */
    .bias-section h2 {
        font-size: 1.2rem;
        flex-wrap: wrap;
    }

    .bias-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    /* Carousel - larger on mobile since stats bar is hidden */
    .carousel-container {
        min-height: 500px;
        height: 60vh !important;
        max-height: 600px;
        overflow: hidden;
    }

    .carousel-slide {
        padding: 5px;
        gap: 8px;
        grid-template-columns: 1fr !important;
        overflow: hidden;
    }

    /* Weather slide - show only 1 card filling the entire space on mobile */
    .carousel-slide.weather-slide {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0 !important;
        padding: 0 !important;
        height: 100% !important;
    }

    .carousel-slide.weather-slide > * {
        scroll-snap-align: start;
        min-width: 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Mobile weather card - complete reorganization */
    .modern-weather-card {
        padding: 0.8rem !important;
        gap: 0.5rem !important;
        max-height: 100% !important;
        overflow: hidden !important;
        justify-content: center !important;
    }

    /* Header row: Day + Date inline */
    .weather-card-header {
        margin-bottom: 0.3rem !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.1rem !important;
    }

    .weather-card-header h3 {
        font-size: 1.1rem !important;
        margin: 0 !important;
    }

    .weather-card-header .date {
        font-size: 0.75rem !important;
    }

    /* City selector smaller */
    .city-selector {
        padding: 0.25rem 0.8rem !important;
        font-size: 0.75rem !important;
        margin: 0.2rem 0 !important;
    }

    /* Icon and temp side by side */
    .weather-icon-temp-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }

    .weather-icon-large {
        font-size: 2.5rem !important;
        margin: 0 !important;
    }

    .weather-temp-large {
        font-size: 2.5rem !important;
        line-height: 1 !important;
        margin: 0 !important;
    }

    .weather-condition {
        font-size: 0.8rem !important;
        margin: 0.2rem 0 !important;
    }

    /* Stats in a horizontal row */
    .weather-stats-group {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.4rem !important;
        margin-top: 0.3rem !important;
    }

    .weather-stat-item {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.7rem !important;
        flex: 0 0 auto !important;
        min-width: auto !important;
    }

    .weather-stat-item .stat-icon {
        font-size: 0.9rem !important;
    }

    .weather-stat-item .stat-value {
        font-size: 0.75rem !important;
    }

    .weather-stat-item .stat-label {
        font-size: 0.6rem !important;
    }

    /* Chat bubble - position on mobile */
    #chatBubble {
        bottom: 20px !important;
        right: 15px !important;
        width: 50px !important;
        height: 50px !important;
    }

    /* Speech bubble tooltip - position above the chat bubble */
    .speech-bubble {
        bottom: 80px !important;
        right: 10px !important;
        max-width: 180px !important;
        font-size: 0.75rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    /* When chat is open, prevent body scrolling on mobile */
    body.chat-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Chat window - always fullscreen on mobile when open */
    #chatWindow.open {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
        max-width: 100vw !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        min-width: 100vw !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        border-radius: 0 !important;
        z-index: 10001 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        box-sizing: border-box !important;
        background: #fff !important;
    }

    #chatWindow.open .chat-window-header {
        border-radius: 0 !important;
        flex-shrink: 0 !important;
    }

    #chatWindow.open .chat-window-footer {
        border-radius: 0 !important;
        flex-shrink: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 10px) !important;
        background: #fff !important;
    }

    #chatWindow.open .chat-window-input {
        flex-shrink: 0 !important;
    }

    #chatWindow.open .chat-window-messages {
        flex: 1 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        background: #f5f5f5 !important;
    }

    /* Hide powered by text on mobile chat */
    #chatWindow.open .chat-powered-by {
        display: none !important;
    }

    /* Listen button - icon only on mobile */
    #chatWindow.open .voice-play-btn .voice-label {
        display: none !important;
    }

    #chatWindow.open .voice-play-btn {
        padding: 8px 12px !important;
        min-width: auto !important;
    }

    /* Hide resize/fullscreen button on mobile - always fullscreen */
    #chatWindow.open .chat-resize-btn,
    #chatWindow.open .chat-fullscreen-btn {
        display: none !important;
    }

    /* Hide scrollbar but keep swipe functionality */
    .carousel-slide.weather-slide::-webkit-scrollbar {
        display: none;
    }

    .carousel-slide.weather-slide {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .carousel-article-item {
        min-height: 380px;
        height: 100%;
    }

    .carousel-content {
        padding: 1.5rem;
    }

    .carousel-content h2 {
        font-size: 1.3rem;
        line-height: 1.4;
    }

    .trending-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    .carousel-nav.prev {
        left: 5px;
    }

    .carousel-nav.next {
        right: 5px;
    }

    .carousel-indicators {
        bottom: 10px;
    }

    .carousel-indicators .dot {
        width: 8px;
        height: 8px;
    }

    /* Country flag badge on carousel */
    .country-flag-badge {
        width: 2rem;
        height: 2rem;
        font-size: 1.25rem;
        top: 0.5rem;
        right: 0.5rem;
    }

    /* Footer */
    footer .footer-content {
        flex-direction: column;
        gap: 2rem;
    }

    .footer-section {
        width: 100%;
    }

    .footer-legal-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-legal-links .separator {
        display: none;
    }
}

/* =============== SMALL MOBILE BREAKPOINT (480px) =============== */
@media (max-width: 480px) {
    /* Even smaller adjustments */
    .contributors-grid {
        grid-template-columns: 1fr;
    }

    .contributor-card a {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .contributor-header {
        flex-direction: column;
        margin-bottom: 0;
        gap: 0.25rem;
    }

    .contributor-rank {
        font-size: 1.2rem;
    }

    .contributor-flag {
        font-size: 1.5rem;
    }

    .contributor-name {
        font-size: 1rem;
    }

    /* Stats bar - stack vertically */
    .stats-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-bar span,
    .stats-bar a span {
        display: block;
        text-align: center;
    }

    /* Carousel */
    .carousel-container {
        min-height: 200px;
    }

    /* Section headers */
    .top-contributors-section h2 {
        font-size: 1.2rem;
    }

    .bias-section h2 {
        font-size: 1rem;
    }

    /* Sidebar toggle position adjustment */
    .mobile-sidebar-toggle {
        top: 100px;
    }
}

/* =============== TOUCH-FRIENDLY ADJUSTMENTS =============== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-links > a,
    .nav-mega-toggle,
    .mega-menu-grid a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Remove hover effects that don't work well on touch */
    .nav-mega-dropdown:hover .nav-mega-menu {
        display: none;
    }

    .nav-mega-menu.show {
        display: block !important;
    }

    /* Scroll momentum for iOS */
    .nav-links,
    .word-cloud-sidebar {
        -webkit-overflow-scrolling: touch;
    }
}

/* =============== LANDSCAPE MOBILE =============== */
@media (max-width: 896px) and (orientation: landscape) {
    .nav-links {
        padding-top: 60px;
    }

    .word-cloud-sidebar {
        padding-top: 60px;
    }

    .carousel-container {
        min-height: 180px;
    }
}

/* =============== ARTICLE PAGE MOBILE STYLES =============== */
@media (max-width: 768px) {
    .article-layout {
        flex-direction: column;
        gap: 1.5rem;
        margin: 1rem 0;
    }

    .article-detail {
        padding: 1rem;
    }

    .article-header h1 {
        font-size: 1.5rem;
        line-height: 1.4;
    }

    .article-meta-detail {
        gap: 0.75rem;
        font-size: 0.85rem;
    }

    .article-body {
        font-size: 1rem;
        line-height: 1.7;
    }

    .article-summary {
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .continue-reading-cta {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }

    .cta-content {
        flex-direction: column;
        gap: 1rem;
    }

    .cta-icon {
        font-size: 2.5rem;
    }

    .cta-text h4 {
        font-size: 1.2rem;
    }

    .cta-button {
        width: 100%;
        text-align: center;
        padding: 0.875rem 1.5rem;
    }

    .source-badge {
        flex-wrap: wrap;
        font-size: 0.85rem;
    }

    /* Breadcrumb navigation */
    .breadcrumb {
        flex-wrap: wrap;
        gap: 0.3rem;
        font-size: 0.8rem;
    }

    .breadcrumb a,
    .breadcrumb .current {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* =============== SAFE AREA INSETS (Notch phones) =============== */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .navbar {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }

        .nav-links {
            padding-left: max(20px, env(safe-area-inset-left));
            padding-right: max(20px, env(safe-area-inset-right));
            padding-bottom: max(20px, env(safe-area-inset-bottom));
        }

        footer {
            padding-bottom: max(1rem, env(safe-area-inset-bottom));
        }
    }
}
