/* ============================================================
   MOBILE RESPONSIVE STYLES
   Loaded after site.css and home.css to override for smaller screens
   ============================================================ */

/* ============ TABLETS & SMALL LAPTOPS (max 1024px) ============ */
@media (max-width: 1024px) {
    .header .container,
    .footer .container,
    main.container {
        max-width: 100%;
        padding: 0 20px;
    }

    .brand-logo {
        height: 56px;
    }

    .nav-links {
        gap: 16px;
    }

    .hero-title {
        font-size: 48px;
    }

    .hero-sub {
        font-size: 18px;
    }

    .features-grid,
    .ad-grid,
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        width: 100%;
        margin-bottom: 24px;
    }
}

/* ============ MOBILE LANDSCAPE & SMALL TABLETS (max 768px) ============ */
@media (max-width: 768px) {
    /* Header */
    .header {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header .container {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }

    .brand-logo {
        height: 44px;
    }

    /* Hide horizontal logos, use mark only on mobile */
    .brand-logo.horizontal {
        display: none;
    }

    .brand-logo.mark {
        display: block;
    }

    /* Mobile menu toggle */
    .nav-menu {
        order: 3;
        width: 100%;
        flex-direction: column;
        gap: 8px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-menu.show,
    .nav-menu.open {
        max-height: 500px;
        padding: 12px 0;
    }

    .nav-menu a {
        width: 100%;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .nav-menu a:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    /* Mobile menu burger button */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 8px;
        cursor: pointer;
        font-size: 18px;
    }

    /* Search bar */
    .search-bar {
        order: 2;
        width: 100%;
    }

    .search-bar input {
        width: 100%;
    }

    /* Hero section */
    .hero {
        padding: 40px 16px;
        min-height: 50vh;
    }

    .hero-title {
        font-size: 36px;
        line-height: 1.2;
    }

    .hero-sub {
        font-size: 16px;
    }

    .hero-cta {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .hero-cta .btn-primary,
    .hero-cta .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    /* Feature/product grids */
    .features-grid,
    .ad-grid,
    .product-grid,
    .trusted-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Auth pages */
    .auth-card,
    .reset-card {
        margin: 16px;
        padding: 24px;
    }

    .auth-card h2,
    .reset-card h2 {
        font-size: 24px;
    }

    /* Forms */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
    }

    .btn-primary-form {
        width: 100%;
        padding: 14px;
    }

    /* Ad details page */
    .ad-details {
        flex-direction: column;
    }

    .ad-images,
    .ad-info {
        width: 100%;
    }

    .ad-images img {
        max-height: 300px;
        object-fit: cover;
    }

    /* Admin tables */
    .admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table table {
        min-width: 600px;
    }

    /* Profile pages */
    .profile-shell {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        position: static;
        margin-bottom: 24px;
    }

    /* Footer */
    .footer .container {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 24px 16px;
    }

    .footer-links {
        flex-direction: column;
        gap: 8px;
    }

    /* Modal/dialog */
    .modal {
        margin: 16px;
        max-width: calc(100% - 32px);
    }

    /* Hide complex animations on mobile (better performance) */
    .home-page .hero-laptop,
    .home-page .label3d {
        display: none;
    }

    /* CTA sections */
    .cta-band {
        padding: 40px 16px;
    }

    .cta-brand img {
        max-width: 80%;
        height: auto;
    }

    /* Trusted seller profile */
    .seller-profile {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .seller-avatar {
        margin: 0 auto;
    }

    /* Comments section */
    .comment {
        padding: 12px;
    }

    .comment-form textarea {
        min-height: 80px;
    }
}

/* ============ MOBILE PORTRAIT (max 480px) ============ */
@media (max-width: 480px) {
    .hero-title {
        font-size: 28px;
    }

    .hero-sub {
        font-size: 15px;
    }

    .brand-logo {
        height: 36px;
    }

    .header .container {
        padding: 8px 12px;
    }

    /* Smaller buttons */
    .btn-primary,
    .btn-secondary,
    .btn-primary-form {
        padding: 10px 16px;
        font-size: 15px;
    }

    /* Auth */
    .auth-card,
    .reset-card {
        padding: 20px 16px;
        border-radius: 12px;
    }

    /* Card padding */
    .ad-card,
    .feature-card,
    .product-card {
        padding: 12px;
    }

    /* Section spacing */
    section {
        padding: 24px 12px;
    }

    /* Typography */
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    p  { font-size: 14px; }

    /* Footer */
    .footer {
        font-size: 13px;
    }

    /* Admin stats */
    .admin-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .admin-stat {
        padding: 12px;
    }

    .admin-stat .stat-value {
        font-size: 22px;
    }

    /* Image upload */
    .image-upload-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============ EXTRA SMALL (max 360px) ============ */
@media (max-width: 360px) {
    .hero-title {
        font-size: 24px;
    }

    .brand-logo {
        height: 32px;
    }

    .nav-links a {
        font-size: 14px;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }
}

/* ============ TOUCH-FRIENDLY ENHANCEMENTS ============ */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets on touch devices */
    a, button, .btn, .nav-links a {
        min-height: 44px;
    }

    /* Remove hover effects (they don't work on touch) */
    .ad-card:hover,
    .feature-card:hover {
        transform: none;
    }

    /* Enable smooth scroll momentum on iOS */
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* ============ DARK MODE MOBILE TWEAKS ============ */
html[data-theme="dark"] .nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ============ PRINT STYLES (bonus) ============ */
@media print {
    .header,
    .footer,
    .nav-links,
    .mobile-menu-toggle,
    .btn-primary,
    .btn-secondary {
        display: none !important;
    }

    body {
        color: black;
        background: white;
    }
}

/* ============ ACCESSIBILITY: 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;
    }
}
