/* ===== MOBILE FIRST BASE (default) ===== */
html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f6f8;
}
a { color: #2094f3; text-decoration: none; }
a:hover { color: #147ac9; }
img { max-width: 100%; height: auto; }

/* Mobile: hide utility bar and breaking news */
.utility-bar { display: none; }
.breaking-bar { display: none; }

/* Mobile header: logo + hamburger */
.site-header {
    background: white;
    border-bottom: 1px solid #dcdcdc;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
}
.logo { font-size: 1.3em; font-weight: 800; color: #1b3c6f; }
.logo span { color: #f6921e; }

/* Mobile: hide nav, show hamburger */
.header-nav {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 0;
    border-bottom: 1px solid #eee;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.header-nav.show { display: flex; }
.header-nav a {
    color: #333;
    font-size: 1em;
    font-weight: 500;
    padding: 14px 15px;
    border-bottom: 1px solid #eee;
}
.header-nav a.active { color: #f6921e; }
.mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    font-size: 1.8em;
    color: #333;
    cursor: pointer;
    padding: 5px;
}
.header-search { display: none; }
.header-user { display: none; }

/* Market ticker: scroll horizontal on mobile */
.ticker-bar {
    background: #1b3c6f;
    color: white;
    padding: 8px 0;
    font-size: 0.8em;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
.ticker-bar span {
    display: inline-block;
    margin-right: 25px;
    padding: 0 5px;
}
.ticker-up { color: #4caf50; }
.ticker-down { color: #f44336; }

/* Main layout: single column on mobile */
.page-wrapper {
    margin: 0;
    padding: 0;
}
.left-ad { display: none; }
.main-layout {
    display: flex;
    flex-direction: column;
    padding: 15px 0;
}
.article-column {
    width: 100%;
    margin: 0 0 20px 0;
}
.sidebar-column {
    width: 100%;
    margin: 0;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.75em;
    color: #777;
    margin-bottom: 12px;
    padding: 0 15px;
}
.breadcrumb a { color: #777; }

/* Article header mobile */
.article-category {
    display: inline-block;
    background: #f6921e;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.article-title {
    font-size: 1.4em;
    font-weight: 900;
    line-height: 1.25;
    color: #111;
    margin-bottom: 10px;
    padding: 0 15px;
}
.article-subtitle {
    font-size: 0.9em;
    color: #555;
    line-height: 1.5;
    margin-bottom: 15px;
    padding: 0 15px;
}
.article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7em;
    color: #777;
    margin-bottom: 15px;
    padding: 0 15px 12px 15px;
    border-bottom: 1px solid #e8e8e8;
    flex-wrap: wrap;
}
.author-info { display: flex; align-items: center; gap: 6px; }
.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1b3c6f;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.6em;
}
.share-bar { display: flex; gap: 6px; margin-left: auto; }
.share-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: white;
}
.share-fb { background: #3b5998; }
.share-tw { background: #1da1f2; }
.share-li { background: #0077b5; }
.share-wa { background: #25d366; }

/* Article content mobile */
.article-content {
    background: white;
    border: 1px solid #e8e8e8;
    padding: 15px;
    margin-bottom: 15px;
}
.article-content h2 {
    font-size: 1.1em;
    font-weight: 700;
    margin: 20px 0 10px;
    color: #1b3c6f;
}
.article-content p {
    font-size: 0.95em;
    line-height: 1.7;
    color: #222;
    margin-bottom: 14px;
}
.article-content ul, .article-content ol {
    margin: 12px 0 15px 20px;
}
.article-content li {
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 8px;
}
.article-content blockquote {
    border-left: 3px solid #f6921e;
    padding: 12px 15px;
    margin: 20px 0;
    background: #fafafa;
    font-style: italic;
    color: #444;
}

/* Market table: scroll horizontal on mobile */
.market-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.85em;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}
.market-table th {
    background: #f5f6f8;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e8e8e8;
}
.market-table td {
    padding: 10px;
    border-bottom: 1px solid #e8e8e8;
}
.market-table .positive { color: #4caf50; font-weight: 600; }
.market-table .negative { color: #f44336; font-weight: 600; }

/* Inline ads mobile: compact */
.inline-ad {
    background: linear-gradient(135deg, #e8f4fd 0%, #d0e8f7 100%);
    border: 1px solid #4a90d9;
    border-radius: 4px;
    padding: 12px;
    margin: 15px 0;
    text-align: center;
    position: relative;
}
.inline-ad .ad-label {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.6em;
    color: #999;
    background: white;
    padding: 1px 4px;
    border-radius: 2px;
}
.inline-ad-title {
    font-weight: 700;
    font-size: 0.95em;
    margin-bottom: 5px;
    color: #1b3c6f;
}
.inline-ad-desc {
    font-size: 0.8em;
    color: #444;
    margin-bottom: 10px;
}
.inline-ad-btn {
    display: inline-block;
    background: linear-gradient(135deg, #f6921e 0%, #e8790b 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 700;
}

/* CTA box mobile */
.cta-box {
    background: linear-gradient(135deg, #1b3c6f 0%, #2a5b88 100%);
    color: white;
    padding: 20px 15px;
    border-radius: 4px;
    margin: 20px 0;
    text-align: center;
}
.cta-box h3 {
    font-size: 1.05em;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}
.cta-box p {
    margin-bottom: 15px;
    opacity: 0.9;
    line-height: 1.5;
    color: white;
    font-size: 0.9em;
}
.cta-button {
    display: inline-block;
    background: #f6921e;
    color: #ffffff !important;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 700;
    text-decoration: none;
}

/* Related articles mobile: single column */
.related-section {
    margin-top: 20px;
    padding: 0 15px;
}
.related-section h2 {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 12px;
    color: #1b3c6f;
}
.related-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.related-item {
    background: white;
    border: 1px solid #e8e8e8;
    padding: 12px;
    border-radius: 4px;
}
.related-item h3 {
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 5px;
}
.related-item span {
    font-size: 0.75em;
    color: #999;
}

/* Sidebar widgets mobile */
.sidebar-widget {
    background: white;
    border: 1px solid #e8e8e8;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
}
.sidebar-widget h3 {
    font-size: 0.95em;
    font-weight: 700;
    color: #1b3c6f;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f6921e;
}
.market-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e8e8e8;
    font-size: 0.85em;
}
.market-item:last-child { border-bottom: none; }
.hot-pick {
    padding: 10px 0;
    border-bottom: 1px solid #e8e8e8;
}
.hot-pick:last-child { border-bottom: none; }
.hot-pick-title {
    font-size: 0.85em;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 3px;
}
.hot-pick-meta { font-size: 0.75em; color: #999; }

/* Ad banners mobile */
.ad-banner {
    background: linear-gradient(135deg, #1b3c6f 0%, #2a5b88 100%);
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
    position: relative;
    color: white;
}
.ad-banner .ad-label {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.55em;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.1);
    padding: 1px 4px;
    border-radius: 2px;
}
.ad-title {
    font-weight: 700;
    font-size: 1em;
    margin-bottom: 8px;
    color: white;
}
.ad-subtitle {
    font-size: 0.8em;
    color: rgba(255,255,255,0.85);
    margin-bottom: 12px;
}
.newsletter-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.9em;
}
.newsletter-btn {
    width: 100%;
    padding: 10px;
    background: #f6921e;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9em;
}
.stock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.8em;
}
.stock-row:last-child { border-bottom: none; }
.stock-symbol { font-weight: 700; color: #333; }
.stock-name { font-size: 0.75em; color: #999; }
.stock-price { font-weight: 600; }
.stock-change { font-size: 0.75em; }

/* Footer mobile: single column */
.site-footer {
    background: #1b3c6f;
    color: white;
    padding: 30px 15px 20px;
    margin-top: 30px;
}
.footer-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}
.footer-col h4 {
    font-size: 0.9em;
    font-weight: 700;
    margin-bottom: 12px;
    color: #f6921e;
}
.footer-col a {
    display: block;
    color: rgba(255,255,255,0.7);
    font-size: 0.8em;
    margin-bottom: 6px;
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 15px;
    font-size: 0.75em;
    color: rgba(255,255,255,0.6);
}

/* Mobile sticky bottom ad - hidden on desktop by default */
.mobile-sticky-ad {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(135deg, #1b3c6f 0%, #2a5b88 100%);
    padding: 10px 15px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    align-items: center;
    justify-content: space-between;
}
.mobile-sticky-ad .ad-text {
    color: white;
    font-size: 0.8em;
    font-weight: 600;
}
.mobile-sticky-ad .ad-btn {
    background: #f6921e;
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

/* Show sticky ad only on mobile */
@media (max-width: 767px) {
    .mobile-sticky-ad {
        display: flex !important;
    }
    body {
        padding-bottom: 55px;
    }
}

.clearfix::after { content: ""; display: table; clear: both; }

/* ===== TABLET (>= 768px) ===== */
@media (min-width: 768px) {
    /* 10% side margins */
    .page-wrapper {
        margin: 0 10%;
    }

    /* Show utility bar */
    .utility-bar {
        display: block;
        background: #f8f9fa;
        border-bottom: 1px solid #e8e8e8;
        padding: 6px 5%;
        font-size: 0.8em;
        color: #666;
    }
    .utility-bar-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .utility-left { display: flex; align-items: center; gap: 15px; }
    .utility-right { display: flex; align-items: center; gap: 12px; }
    .utility-link { color: #666; font-size: 0.9em; }
    .utility-link:hover { color: #f6921e; }
    .social-icons { display: flex; gap: 8px; }
    .social-icons a {
        width: 22px;
        height: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #999;
    }
    .social-icons a:hover { color: #f6921e; }

    /* Show full header */
    .header-top { padding: 10px 5%; }
    .logo { font-size: 1.5em; }
    .mobile-menu-btn { display: none; }
    .header-nav {
        display: flex !important;
        flex-direction: row;
        gap: 20px;
        padding: 0;
        border: none;
        background: transparent;
        position: static;
        top: auto;
        left: auto;
        right: auto;
        box-shadow: none;
    }
    .header-nav a {
        padding: 0;
        border: none;
        font-size: 0.9em;
    }
    .header-search {
        display: flex;
        align-items: center;
        background: #f5f6f8;
        border-radius: 4px;
        padding: 4px 10px;
        margin: 0 20px;
    }
    .header-search input {
        border: none;
        background: none;
        outline: none;
        font-size: 0.85em;
        padding: 4px;
        width: 140px;
    }
    .header-search button {
        border: none;
        background: none;
        color: #999;
        cursor: pointer;
        font-size: 0.9em;
    }
    .header-user { display: flex; gap: 10px; align-items: center; }
    .btn-signin {
        padding: 8px 16px;
        border: 1px solid #ccc;
        border-radius: 4px;
        font-size: 0.85em;
    }
    .btn-signup {
        padding: 8px 16px;
        background: #f6921e;
        color: white;
        border-radius: 4px;
        font-size: 0.85em;
        font-weight: 600;
    }

    /* Layout: article left, sidebar right */
    .main-layout {
        padding: 20px 0;
        display: flex;
        flex-direction: row;
    }
    .article-column {
        flex: 0 0 70%;
        margin-right: 20px;
    }
    .sidebar-column {
        flex: 0 0 calc(30% - 20px);
    }

    /* Article larger on tablet */
    .article-title {
        font-size: 1.8em;
        padding: 0;
    }
    .article-subtitle {
        font-size: 1em;
        padding: 0;
    }
    .article-content { padding: 30px; }
    .article-content h2 { font-size: 1.4em; }
    .article-content p { font-size: 1.05em; }
    .article-content li { font-size: 1.05em; }

    /* Related grid: 2 columns */
    .related-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .related-item h3 { font-size: 0.95em; }

    /* Footer: 2 columns */
    .footer-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    .site-footer { padding: 40px 10% 20px; }
}

/* ===== DESKTOP (>= 1024px) ===== */
@media (min-width: 1024px) {
    /* 10% side margins */
    .page-wrapper {
        margin: 0 10%;
    }

    /* Show breaking news on desktop only */
    .breaking-bar {
        display: block;
        background: #f6921e;
        color: white;
        padding: 6px 0;
        font-size: 0.85em;
        overflow: hidden;
        position: relative;
    }
    .breaking-label {
        background: #d35400;
        padding: 4px 12px;
        font-weight: 700;
        font-size: 0.75em;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        display: flex;
        align-items: center;
        z-index: 10;
    }
    .breaking-content {
        white-space: nowrap;
        animation: scroll 40s linear infinite;
        padding-left: 80px;
    }
    @keyframes scroll {
        0% { transform: translateX(100%); }
        100% { transform: translateX(-100%); }
    }
    .breaking-content a {
        color: white;
        font-weight: 500;
        margin-right: 50px;
    }

    /* Larger article title */
    .article-title {
        font-size: 2.8em;
        margin-bottom: 15px;
    }
    .article-subtitle {
        font-size: 1.1em;
        margin-bottom: 20px;
    }
    .article-meta { font-size: 0.85em; }

    /* Inline ads larger */
    .inline-ad {
        padding: 25px;
        border-radius: 8px;
        margin: 25px 0;
    }
    .inline-ad-title { font-size: 1.1em; }
    .inline-ad-desc { font-size: 0.9em; }
    .inline-ad-btn {
        padding: 12px 25px;
        border-radius: 50px;
        font-size: 0.9em;
    }

    /* CTA larger */
    .cta-box { padding: 30px; border-radius: 6px; }
    .cta-box h3 { font-size: 1.4em; }
    .cta-box p { font-size: 1em; }
    .cta-button {
        padding: 14px 35px;
        border-radius: 50px;
        font-size: 1em;
    }

    /* Sidebar ads larger */
    .ad-banner { padding: 25px; border-radius: 8px; }
    .ad-title { font-size: 1.15em; }
    .ad-subtitle { font-size: 0.9em; }

    /* Footer: 4 columns */
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .footer-col h4 { font-size: 0.95em; }
    .footer-col a { font-size: 0.85em; }
}

/* ===== LARGE DESKTOP (>= 1200px) ===== */
@media (min-width: 1200px) {
    .left-ad {
        display: block;
        position: absolute;
        top: 480px;
        left: 10px;
        width: calc(10% - 20px);
        height: 550px;
    }
    .left-ad-inner {
        background: linear-gradient(rgba(10,40,80,0.88), rgba(10,40,80,0.88)), url('/static/img/ad-bg2.png') center/cover no-repeat;
        border: 2px solid #4a90d9;
        border-radius: 4px;
        padding: 25px;
        color: white;
        text-align: center;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .left-ad-title {
        font-weight: 700;
        font-size: 1.2em;
        margin-bottom: 10px;
        color: white;
    }
    .left-ad-desc {
        font-size: 0.85em;
        color: rgba(255,255,255,0.9);
        margin-bottom: 15px;
        line-height: 1.5;
    }
    .left-ad-btn {
        background: linear-gradient(135deg, #f6921e 0%, #e8790b 100%);
        color: white;
        padding: 10px 20px;
        border-radius: 4px;
        font-weight: 700;
        font-size: 0.85em;
        display: inline-block;
    }

    /* Full desktop header */
    .logo { font-size: 1.8em; }
    .header-nav { gap: 25px; }
    .header-nav a { font-size: 0.95em; font-weight: 600; }
    .header-nav a.active {
        color: #f6921e;
        border-bottom: 2px solid #f6921e;
        padding-bottom: 2px;
    }
}