/**
 * Responsive Design - Tanzania Business Blog
 * Mobile-first approach with breakpoints
 */

/* Responsive Breakpoints */
/* Mobile: 320px - 767px */
/* Tablet: 768px - 1023px */
/* Desktop: 1024px+ */

/* Mobile Styles (Default) */
@media (max-width: 767px) {

    /* Base Layout */
    .container {
        padding: 0 1rem;
    }

    .section-spacing {
        padding: 2rem 0;
    }

    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 2rem;
    }

    /* Header */
    .top-bar {
        display: none;
    }

    .header-content {
        padding: 0.5rem 0;
    }

    .logo a {
        gap: 0.75rem;
    }

    .logo-img {
        width: 40px;
        height: 40px;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .tagline {
        font-size: 0.75rem;
    }

    /* Mobile Logo */
    .mobile-logo-img {
        height: 40px;
        /* Increased from 28px */
        max-width: 150px;
        /* Increased from 100px */
    }

    /* Hero Section */
    .hero-section {
        height: 400px;
        margin-bottom: 1.5rem;
    }

    .hero-content {
        padding: 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }

    .hero-excerpt {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .hero-navigation {
        padding: 0 1rem;
    }

    .hero-nav-btn {
        width: 40px;
        height: 40px;
    }

    .hero-indicators {
        bottom: 1rem;
    }

    /* Content Layout */
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        order: -1;
        /* Move sidebar above content on mobile */
    }

    /* Featured Articles */
    .featured-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 1rem;
    }

    .featured-main {
        grid-row: span 1;
    }

    .featured-main .card-image {
        height: 250px;
    }

    .featured-secondary .card-image {
        height: 200px;
    }

    .card-content {
        padding: 1rem;
    }

    .card-meta {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .card-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .card-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    /* Categories Showcase */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .category-showcase-card {
        padding: 1.5rem;
    }

    .category-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }

    .category-icon i {
        font-size: 1.25rem;
    }

    .category-stats {
        flex-direction: column;
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }

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

    .article-card .card-image {
        height: 180px;
    }

    /* Newsletter */
    .newsletter-container {
        padding: 2rem 1rem;
    }

    .newsletter-content h2 {
        font-size: 1.5rem;
    }

    .newsletter-form .form-group {
        flex-direction: column;
        gap: 0.75rem;
        max-width: 100%;
    }

    .newsletter-input,
    .newsletter-btn {
        width: 100%;
        padding: 0.875rem;
    }

    /* Widgets */
    .widget {
        margin-bottom: 1.5rem;
    }

    .widget-content {
        padding: 1rem;
    }

    .trending-item {
        padding: 0.75rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .trending-number {
        position: static;
        margin-bottom: 0.5rem;
    }

    /* Mobile Ads */
    .sidebar-ad {
        display: none;
        /* Hide sidebar ads on mobile */
    }

    /* Mobile Ad Banner */
    .mobile-ad-banner {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 2px solid #9FCCEC;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 999;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .mobile-ad-banner.show {
        transform: translateY(0);
    }

    .mobile-ad-content {
        position: relative;
        padding: 1rem;
        text-align: center;
    }

    .mobile-ad-close {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        background: none;
        border: none;
        color: #666;
        font-size: 1rem;
        cursor: pointer;
        padding: 0.25rem;
        border-radius: 50%;
        transition: all 0.3s ease;
    }

    .mobile-ad-close:hover {
        background: #f0f0f0;
        color: #000179;
    }

    .mobile-ad-image {
        max-height: 80px;
        width: auto;
        margin: 0 auto;
    }

    .mobile-ad-text h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        color: #000179;
    }

    .mobile-ad-text p {
        font-size: 0.875rem;
        color: #666;
        margin: 0;
    }

    /* Back to Top */
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }

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

    .footer-newsletter .newsletter-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .footer-newsletter .newsletter-info h2 {
        font-size: 1.5rem;
    }

    .footer-newsletter-form .newsletter-input-group {
        flex-direction: column;
        gap: 0.75rem;
        max-width: 100%;
    }

    .newsletter-email-input,
    .newsletter-subscribe-btn {
        width: 100%;
        padding: 0.875rem;
    }

    .footer-bottom-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-bottom-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
    }

    /* Social Links */
    .social-links {
        justify-content: center;
        gap: 1rem;
    }

    .social-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Spacing Adjustments */
    .section-header {
        margin-bottom: 2rem;
    }

    .section-footer {
        margin-top: 1.5rem;
    }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1023px) {

    /* Header */
    .header-content {
        padding: 0.75rem 0;
    }

    .logo-img {
        width: 45px;
        height: 45px;
    }

    .site-title {
        font-size: 1.5rem;
    }

    /* Mobile Logo */
    .mobile-logo-img {
        height: 42px;
        /* Increased from 30px */
        max-width: 160px;
        /* Increased from 110px */
    }

    /* Hero Section */
    .hero-section {
        height: 500px;
    }

    .hero-title {
        font-size: 2rem;
    }

    /* Content Layout */
    .content-wrapper {
        grid-template-columns: 1fr 250px;
        gap: 1.5rem;
    }

    /* Featured Articles */
    .featured-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 1.25rem;
    }

    .featured-main {
        grid-column: span 2;
        grid-row: span 1;
    }

    .featured-main .card-image {
        height: 300px;
    }

    /* Categories Grid */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

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

    /* Newsletter */
    .newsletter-form .form-group {
        max-width: 400px;
    }

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

    .company-info {
        grid-column: span 2;
    }

    /* Sidebar */
    .widget {
        margin-bottom: 1.5rem;
    }

    .trending-item {
        padding: 1rem 0;
    }

    /* Ads */
    .sidebar-ad {
        margin-bottom: 1rem;
    }

    .mobile-ad-banner {
        display: none;
        /* Hide mobile banner on tablet */
    }
}

/* Large Tablet/Small Desktop */
@media (min-width: 1024px) and (max-width: 1199px) {

    .container {
        max-width: 1000px;
    }

    /* Content Layout */
    .content-wrapper {
        grid-template-columns: 1fr 280px;
        gap: 2rem;
    }

    /* Featured Articles */
    .featured-grid {
        grid-template-columns: 2fr 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .featured-main {
        grid-row: span 2;
    }

    /* Categories Grid */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    /* Footer */
    .footer-grid {
        grid-template-columns: 2fr repeat(3, 1fr);
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {

    /* Hide mobile elements on desktop */
    .mobile-search-toggle,
    .mobile-nav-toggle,
    .mobile-navigation,
    .mobile-nav-overlay,
    .mobile-search,
    .mobile-logo {
        display: none !important;
    }

    /* Ensure desktop elements are visible */
    .desktop-search-toggle {
        display: flex !important;
    }

    /* Ensure proper scrolling */
    body {
        overflow-y: auto;
        height: auto;
    }

    .main-content {
        overflow: visible;
        height: auto;
    }

    /* Container sizing */
    .container {
        max-width: 95%;
        margin: 0 auto;
        padding: 0 2rem;
    }

    /* Hero section adjustments */
    .hero-section {
        height: auto;
        min-height: 320px;
        padding: 15px 0 0;
        margin-bottom: 0 !important;
    }

    /* Reduce gap between hero and main content on desktop */
    .main-content-area {
        margin-top: 0 !important;
        padding-top: 10px !important;
    }

    .hero-layout {
        grid-template-columns: 2fr 1fr;
        gap: 50px;
        background: transparent;
    }

    /* Content layout */
    .content-wrapper {
        grid-template-columns: 1fr 300px;
        gap: 2rem;
    }

    /* Featured articles grid */
    .featured-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.5rem;
    }

    .featured-main {
        grid-column: span 2;
        grid-row: span 2;
    }

    /* Categories grid */
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    /* Articles grid */
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    /* Newsletter form */
    .newsletter-form .form-group {
        max-width: 500px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }

    /* Sidebar widgets */
    .widget {
        margin-bottom: 2rem;
    }

    /* Hide mobile-specific elements */
    .mobile-ad-banner,
    .mobile-only {
        display: none !important;
    }
}

/* Large Desktop Styles */
@media (min-width: 1200px) {

    .container {
        max-width: 95%;
        padding: 0 3rem;
    }

    .hero-section {
        height: auto;
        min-height: 340px;
        padding: 15px 0 0;
        margin-bottom: 0 !important;
    }

    .main-content-area {
        margin-top: 0 !important;
        padding-top: 10px !important;
    }

    .hero-headline {
        font-size: 3rem;
    }

    .featured-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 2rem;
    }

    .articles-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* Extra Large Desktop */
@media (min-width: 1400px) {

    .container {
        max-width: 95%;
        padding: 0 4rem;
    }

    .hero-section {
        height: auto;
        min-height: 100px;
        padding: 15px 0 0;
        margin-bottom: 0 !important;
    }

    .main-content-area {
        margin-top: 0 !important;
        padding-top: 10px !important;
    }

    .hero-headline {
        font-size: 3.5rem;
    }
}

/* Landscape Mobile Orientation */
@media (max-width: 767px) and (orientation: landscape) {

    .hero-section {
        height: 350px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-excerpt {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .newsletter-container {
        padding: 1.5rem 1rem;
    }

    .footer-newsletter .newsletter-content {
        flex-direction: row;
        text-align: left;
    }

    .footer-newsletter-form .newsletter-input-group {
        flex-direction: row;
        max-width: 400px;
    }
}

/* Print Styles */
@media print {

    .top-bar,
    .mobile-menu-toggle,
    .search-bar,
    .hero-navigation,
    .hero-indicators,
    .back-to-top,
    .mobile-ad-banner,
    .newsletter-section,
    .footer-newsletter,
    .social-links,
    .mobile-social {
        display: none !important;
    }

    .hero-section {
        height: auto;
        background: none !important;
        color: #000 !important;
    }

    .hero-overlay {
        display: none;
    }

    .hero-content {
        color: #000 !important;
        padding: 1rem 0;
    }

    .hero-title,
    .hero-title a {
        color: #000 !important;
    }

    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .featured-grid,
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-image {
        height: 200px !important;
    }

    .footer-main {
        display: none;
    }

    .footer-bottom {
        border-top: 1px solid #ccc;
        padding: 1rem 0;
    }

    /* Print Typography */
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        color: #000;
        page-break-after: avoid;
    }

    .card-title {
        font-size: 14pt;
    }

    .card-excerpt {
        font-size: 11pt;
    }

    /* Page Breaks */
    .featured-card,
    .article-card {
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }

    .section-spacing {
        page-break-inside: avoid;
    }
}

/* High DPI/Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .logo-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .hero-section {
        background-attachment: scroll;
        /* Better performance on retina */
    }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {

    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero-slide {
        transition: none;
    }

    .back-to-top {
        transition: none;
    }

    .mobile-ad-banner {
        transition: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {

    /* to do */

}

/* Container Queries (Future Enhancement) */
/* When supported, these could replace some media queries */
/* @container (max-width: 300px) {
    .article-card .card-content {
        padding: 0.75rem;
    }
} */