/**
 * SummerCave — Mobile Responsive Stylesheet
 * Covers: Hero, Header, Products, Cart, Checkout, Admin Panel, Settings
 */

/* ═══════════════════════════════════════════════
   TABLET  (max-width: 1024px)
═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .hero-card { padding: 40px 30px; }
    .hero-title { font-size: 2.2rem; }
    .hero-images-container { width: 300px; height: 300px; inset-inline-end: 20px; }
    .hero-content { max-width: 55%; }
}

/* ═══════════════════════════════════════════════
   MOBILE  (max-width: 768px)
═══════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Global ── */
    .container {
        padding-inline: 14px !important;
    }

    /* ── Header / Navbar ── */
    .site-header {
        padding: 10px 0;
        position: sticky;
        top: 0;
        z-index: 999;
    }
    .header-wrapper {
        gap: 8px;
        flex-wrap: nowrap;
    }
    .logo-link { font-size: 1.1rem; gap: 5px; }
    .nav-menu { display: none !important; }
    .header-actions { gap: 6px; }
    .action-btn { width: 36px; height: 36px; font-size: 0.95rem; }
    .lang-switch { padding: 4px 8px; font-size: 0.75rem; }
    .lang-switch span { display: none; }

    /* ── Hero Section / Slider ── */
    .hero-section { padding: 16px 0 24px; }

    .hero-card {
        padding: 0;
        border-radius: 20px;
        overflow: hidden;
    }

    .hero-slide {
        flex-direction: column;
        align-items: center;
        padding: 20px 16px 52px;
        min-height: auto;
        text-align: center;
        gap: 0;
    }

    .hero-content {
        max-width: 100%;
        width: 100%;
        z-index: 2;
        position: relative;
    }

    .hero-tag {
        font-size: 0.72rem;
        padding: 4px 12px;
        margin-bottom: 10px;
    }

    .hero-title {
        font-size: 1.45rem;
        line-height: 1.35;
        margin-bottom: 8px;
    }

    .hero-desc {
        font-size: 0.85rem;
        margin-bottom: 12px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .hero-price-tag {
        justify-content: center;
        margin-bottom: 14px;
        gap: 8px;
    }

    .hero-current-price { font-size: 1.5rem !important; }
    .hero-old-price { font-size: 0.9rem !important; }

    .hero-btns {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .hero-btns .btn {
        width: 100%;
        padding: 11px 14px;
        font-size: 0.85rem;
        justify-content: center;
    }

    /* Hero image — stacked above text, in document flow */
    .hero-images-container {
        position: relative;
        inset: auto;
        order: -1;
        top: auto;
        bottom: auto;
        transform: none;
        width: 100%;
        max-width: 220px;
        height: 170px;
        margin: 0 auto 14px;
        opacity: 1;
    }

    .hero-float-img {
        max-height: 160px;
        width: auto;
        max-width: 100%;
        margin: 0 auto;
        display: block;
        animation: none;
    }

    .hero-glow-back {
        width: 130px;
        height: 130px;
        left: 50%;
        right: auto;
        transform: translateX(-50%) scale(0.5);
    }

    .hero-slide.active .hero-glow-back {
        transform: translateX(-50%) scale(1);
    }

    .hero-arrow { display: none; }

    .hero-db-badge {
        top: 12px;
        inset-inline-start: 12px;
        inset-inline-end: auto;
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    /* ── Category Section ── */
    .section-title { font-size: 1.4rem; }
    .section-subtitle { font-size: 0.85rem; }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }

    .category-card-item {
        padding: 14px 8px !important;
    }

    .cat-icon { font-size: 1.6rem !important; }
    .cat-name { font-size: 0.75rem !important; }
    .cat-count { font-size: 0.65rem !important; }

    /* ── Filter Bar ── */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 0;
        margin-bottom: 20px;
    }

    .category-tags {
        gap: 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .category-tags::-webkit-scrollbar { display: none; }

    .category-tag {
        white-space: nowrap;
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .search-box {
        width: 100%;
    }

    /* ── Products Grid ── */
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .product-card {
        border-radius: 14px;
    }

    .product-card .product-img-wrap {
        height: 160px;
    }

    .product-card .product-info {
        padding: 10px 12px;
    }

    .product-title { font-size: 0.85rem !important; }
    .product-price { font-size: 1rem !important; }

    .product-card .btn {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    /* ── Hot Deals ── */
    .hot-deals-grid,
    .deal-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* ── Feature Cards ── */
    .features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .feature-card { padding: 18px 14px !important; }

    /* ── Cart Page ── */
    .cart-layout {
        flex-direction: column !important;
        gap: 20px;
    }

    .cart-table-wrap, .cart-summary {
        width: 100% !important;
    }

    .cart-table th:nth-child(3),
    .cart-table td:nth-child(3) { display: none; }

    /* ── Checkout ── */
    .checkout-grid {
        flex-direction: column !important;
        gap: 20px;
    }

    .checkout-left, .checkout-right {
        width: 100% !important;
    }

    /* ── Footer ── */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    .footer-bottom {
        flex-direction: column !important;
        gap: 10px !important;
        text-align: center;
    }

    /* ── Product Detail Page ── */
    .product-detail-grid {
        flex-direction: column !important;
    }

    .product-detail-img { width: 100% !important; }
    .product-detail-info { width: 100% !important; padding-inline-start: 0 !important; }

    /* ── Search Suggestions ── */
    .search-suggestions-dropdown {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }

    /* ── Newsletter ── */
    .newsletter-form {
        flex-direction: column !important;
    }
    .newsletter-form input,
    .newsletter-form .btn { width: 100% !important; }

    /* ── Buttons ── */
    .btn-lg { padding: 11px 20px !important; font-size: 0.9rem !important; }
}

/* ═══════════════════════════════════════════════
   SMALL MOBILE  (max-width: 480px)
═══════════════════════════════════════════════ */
@media (max-width: 480px) {

    /* Hero even more compact */
    .hero-slide { padding: 16px 14px 48px; }
    .hero-title { font-size: 1.25rem; }
    .hero-current-price { font-size: 1.35rem !important; }

    .hero-images-container { max-width: 190px; height: 150px; margin-bottom: 10px; }
    .hero-float-img { max-height: 140px; }

    /* Products single column on very small screens */
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .product-card .product-img-wrap { height: 130px; }

    /* Categories */
    .categories-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

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

/* ═══════════════════════════════════════════════
   ADMIN PANEL — MOBILE  (max-width: 768px)
═══════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Admin Cards & Grid ── */
    .card {
        padding: 16px !important;
        border-radius: 14px !important;
    }

    .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* ── Stats Grid ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat-card { padding: 14px !important; }
    .stat-value { font-size: 1.4rem !important; }

    /* ── Admin Tables → Horizontal Scroll ── */
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    table {
        min-width: 600px;
    }

    /* Taager products table */
    .admin-content-container table {
        min-width: 700px;
    }

    .admin-content-container .admin-table-stack {
        min-width: 0 !important;
    }

    td, th {
        padding: 10px 10px !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
    }

    /* ── Settings Page ── */
    .settings-tabs {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        padding-bottom: 6px;
        scrollbar-width: none;
    }
    .settings-tabs::-webkit-scrollbar { display: none; }

    .settings-tab {
        white-space: nowrap;
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
    }

    .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .form-group { margin-bottom: 14px !important; }
    .form-label { font-size: 0.82rem !important; }
    .form-control { padding: 9px 12px !important; font-size: 0.88rem !important; }

    /* ── Admin Topbar ── */
    .admin-topbar {
        padding: 0 12px !important;
        height: 58px !important;
    }

    .topbar-right { gap: 8px !important; }

    /* ── Sync Log Timeline ── */
    .sync-timeline { padding-inline-start: 20px !important; }

    .sync-entry { padding: 10px 0 !important; }

    .sync-entry.sync-latest .sync-content {
        padding: 10px !important;
    }

    /* Summary stats on mobile */
    .sync-timeline ~ div,
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    /* ── Taager Admin Specific ── */
    .link-input {
        width: 80px !important;
        font-size: 0.78rem !important;
    }

    /* ── Buttons in admin ── */
    .btn-sm {
        padding: 5px 8px !important;
        font-size: 0.75rem !important;
    }

    /* ── Admin Dashboard orders list ── */
    .orders-list .order-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px;
    }

    /* ── Page title ── */
    .page-title { font-size: 1.4rem !important; }
    .page-subtitle { font-size: 0.82rem !important; }

    /* ── Import/Form Grids ── */
    .form-row-two {
        flex-direction: column !important;
    }

    /* ── Import range inputs ── */
    input[type="number"][style*="width: 80px"],
    input[type="number"][style*="width:80px"] {
        width: 70px !important;
    }
}

/* ═══════════════════════════════════════════════
   ADMIN PANEL — SMALL  (max-width: 480px)
═══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .card-header .badge,
    .card-header [class*="badge"] {
        font-size: 0.65rem !important;
    }

    /* Sync summary cards */
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: 1fr !important;
    }

    .admin-content-container { padding: 12px 10px !important; }
}

/* ═══════════════════════════════════════════════
   HERO SLIDER DOTS — shared fix
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .hero-slider-dots, .slider-dots {
        bottom: 10px !important;
        gap: 5px !important;
    }
    .slider-dot { width: 6px !important; height: 6px !important; }
}

/* ═══════════════════════════════════════════════
   TOUCH IMPROVEMENTS
═══════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover animations on touch screens */
    .product-card:hover,
    .deal-card:hover,
    .category-card-item:hover {
        transform: none !important;
        box-shadow: none !important;
    }

    /* Larger tap targets */
    .action-btn, .btn, .category-tag, .nav-link {
        min-height: 40px;
    }

    /* Remove backdrop filter on mobile for performance */
    .glass-panel, .card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}
