/* ============================================================
   BullishProspects.com - Responsive Styles
   ============================================================ */

/* ----- 1200px: Large Desktop ----- */
@media (max-width: 1200px) {
    .news-grid.cols-4 { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { gap: 1.5rem; }
    .hero h1 { font-size: 2.5rem; }
}

/* ----- 992px: Tablet Landscape ----- */
@media (max-width: 992px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .news-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .related-posts-grid { grid-template-columns: repeat(2, 1fr); }
    .news-card.featured { grid-column: span 2; }

    /* Content layout: hide sidebar */
    .content-layout { grid-template-columns: 1fr; }
    .content-layout .content-sidebar { display: none; }
    .content-layout .content-sidebar.show {
        display: block;
        position: fixed;
        top: 64px;
        right: 0;
        bottom: 0;
        width: 320px;
        z-index: 300;
        background: var(--bg-primary);
        border-left: 1px solid var(--border-color);
        padding: 1.25rem;
        overflow-y: auto;
        box-shadow: var(--shadow-lg);
    }

    /* Footer to 2-col */
    .footer-grid { grid-template-columns: 1fr 1fr; }

    /* Hero */
    .hero { min-height: 360px; padding: 2.5rem 1.5rem; }
    .hero h1 { font-size: 2.25rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-stats { gap: 2rem; }

    /* Article */
    .article-title { font-size: 1.85rem; }

    /* Author card */
    .author-card { flex-direction: column; align-items: center; text-align: center; }
    .author-card-social { justify-content: center; }

    /* Chart */
    .chart-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

    /* Dashboard responsive */
    .dashboard-layout { grid-template-columns: 1fr; }
    .dashboard-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1100;
        transition: left 0.3s ease;
        width: 280px;
    }
    .dashboard-sidebar.open { left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1099;
    }
    .sidebar-overlay.open { display: block; }
    .sidebar-toggle { display: inline-flex !important; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ----- 768px: Tablet Portrait ----- */
@media (max-width: 768px) {
    /* Navigation - hamburger */
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 0.5rem;
    }
    .nav-links.open,
    .nav-links.active { display: flex; }
    .nav-links a { padding: 0.5rem 0; font-size: 1rem; }
    .hamburger { display: flex; }
    .nav-right .btn-sm { font-size: 0.8rem; padding: 0.35rem 0.75rem; }

    /* Hero */
    .hero { min-height: 300px; padding: 2rem 1rem; }
    .hero h1 { font-size: 1.85rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .hero-actions { flex-direction: column; width: 100%; }
    .hero-actions .btn { width: 100%; }
    .hero-stats { flex-direction: column; gap: 0.75rem; }

    /* Ticker */
    .ticker-content { animation-duration: 30s; }

    /* News grid single column */
    .news-grid,
    .news-grid.cols-2,
    .news-grid.cols-4 { grid-template-columns: 1fr; }
    .news-card.featured { grid-column: span 1; }
    .news-card.featured .news-card-image { aspect-ratio: 16 / 9; }
    .news-card.featured .news-card-title { font-size: 1.15rem; }
    .news-card.horizontal { grid-template-columns: 1fr; }
    .news-card.horizontal .news-card-image { aspect-ratio: 16 / 9; }
    .related-posts-grid { grid-template-columns: 1fr; }

    /* Article */
    .article { padding: 1.5rem 1rem; }
    .article-title { font-size: 1.6rem; }
    .article-body { font-size: 0.95rem; }
    .article-meta { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

    /* Market bar */
    .market-bar-inner { padding: 0 1rem; }

    /* Footer stacking */
    .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .footer-bottom { text-align: center; }

    /* Forms full width */
    .form-control { font-size: 1rem; /* Prevent iOS zoom */ }

    /* Modal */
    .modal-content { max-width: 100%; padding: 1.5rem; }

    /* Toast */
    .toast-container { left: 1rem; right: 1rem; max-width: none; }

    /* Table */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Pagination wrap */
    .pagination { flex-wrap: wrap; }

    /* Share bar */
    .share-bar { flex-wrap: wrap; }

    /* Comments */
    .comment-form { flex-direction: column; }
    .comment-replies { padding-left: 0.75rem; }

    /* Breadcrumb scroll */
    .breadcrumb { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
    .breadcrumb::-webkit-scrollbar { display: none; }

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

    /* Ad slots */
    .ad-slot.leaderboard { max-width: 100%; }

    /* Watchlist */
    .watchlist-item { grid-template-columns: 1fr auto; gap: 0.5rem; }

    /* Auth card */
    .auth-card .card { padding: 1.5rem; }
    .auth-card h1 { font-size: 1.5rem; }

    /* Dashboard stats */
    .stats-grid { grid-template-columns: 1fr; }
}

/* ----- 576px: Large Phone ----- */
@media (max-width: 576px) {
    .container { padding: 0 1rem; }

    .hero { min-height: 260px; padding: 1.5rem 1rem; }
    .hero h1 { font-size: 1.6rem; }
    .hero-badge { font-size: 0.75rem; }

    /* Touch-friendly button sizes (min 44px) */
    .btn { min-height: 44px; padding: 0.7rem 1.25rem; }
    .btn-sm { min-height: 44px; padding: 0.6rem 1rem; }
    .pagination a, .pagination span { min-width: 44px; height: 44px; }
    .share-btn { width: 44px; height: 44px; }
    .nav-bell, .notification-count-wrapper { min-width: 44px; min-height: 44px; }
    .hamburger { min-width: 44px; min-height: 44px; }

    /* Cards */
    .news-card-body { padding: 1rem; }
    .news-card-footer { padding: 0.5rem 1rem; }
    .news-card-title { font-size: 1rem; }
    .news-card.compact .news-card-image { width: 72px; }

    /* Article */
    .article-title { font-size: 1.4rem; }
    .article-body { font-size: 0.9rem; line-height: 1.75; }

    /* Sidebar widget */
    .sidebar-widget { padding: 1rem; }

    /* Modal */
    .modal-content { padding: 1.25rem; }

    /* Author card */
    .author-card { padding: 1rem; }
    .author-card-avatar { width: 52px; height: 52px; }

    /* Ticker tags */
    .ticker-tags { gap: 0.25rem; }
    .ticker-tag { font-size: 0.75rem; padding: 3px 8px; }

    /* Word cloud */
    .word-cloud { padding: 0.75rem; }
    .word-cloud-item.xl { font-size: 1.3rem; }
    .word-cloud-item.lg { font-size: 1.05rem; }
}

/* ----- 480px: Small Phone ----- */
@media (max-width: 480px) {
    .container { padding: 0 0.75rem; }

    .nav-container { padding: 0 0.75rem; height: 56px; }
    .logo { font-size: 1.25rem; }

    .ticker-tape { height: 32px; font-size: 0.75rem; }
    .ticker-content { animation-duration: 25s; }

    .hero { padding: 1.25rem 0.75rem; }
    .hero h1 { font-size: 1.4rem; }
    .hero-subtitle { font-size: 0.85rem; }
    .hero-stat-value { font-size: 1.3rem; }

    .news-card-meta { font-size: 0.7rem; }
    .news-card-title { font-size: 0.95rem; }
    .news-card-excerpt { font-size: 0.8rem; }

    .article-title { font-size: 1.25rem; }
    .article-body h2 { font-size: 1.25rem; }
    .article-body h3 { font-size: 1.1rem; }

    .market-bar-item { padding: 0.25rem 0.5rem; }
    .market-bar-name, .market-bar-value, .market-bar-change { font-size: 0.75rem; }

    .site-footer { padding: 2rem 0 1rem; }
    .footer-container { padding: 0 0.75rem; }

    .comment { gap: 0.5rem; padding: 0.75rem 0; }
    .comment-avatar { width: 26px; height: 26px; }
    .comment-replies { padding-left: 0.5rem; }

    .badge { font-size: 0.65rem; padding: 2px 8px; }

    .loading-overlay { padding: 2rem; }
    .empty-state { padding: 2rem; }
    .empty-state i { font-size: 2rem; }

    .auth-page { padding: 1rem 0.5rem; }
    .auth-card .card { padding: 1.25rem; }
    .btn-lg { padding: 0.7rem 1.5rem; }
}

/* ----- Landscape orientation ----- */
@media (max-height: 500px) and (orientation: landscape) {
    .hero { min-height: auto; padding: 1.5rem 1rem; }
    .hero-stats { flex-direction: row; gap: 1.5rem; }
    .modal-content { max-height: 85vh; overflow-y: auto; }
}

/* ----- Print ----- */
@media print {
    .site-header,
    .ticker-tape,
    .site-footer,
    .ad-slot,
    .share-bar,
    .toast-container,
    .sidebar-toggle,
    .hamburger,
    .modal-overlay,
    .nav-right { display: none !important; }

    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
    .card, .sidebar-widget, .chart-container, .news-card {
        border: 1px solid #ccc;
        box-shadow: none;
        background: white;
    }
    a { color: black; text-decoration: underline; }
    .article-body { color: #333; }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .ticker-content { animation: none; }
}

/* ----- High contrast ----- */
@media (prefers-contrast: high) {
    :root {
        --border-color: #3A4A5E;
        --text-muted: #A0AAC0;
    }
    .card, .news-card, .sidebar-widget, .chart-container, .modal-content {
        border-width: 2px;
    }
}
