/* =====================================================
   SESY QUEEN — Mobile Responsiveness Fix
   Fixes layout overflow and nav crowding on mobile
   ===================================================== */

/* Prevent horizontal overflow globally */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* ── Navbar: keep icons from overflowing ── */
@media (max-width: 768px) {
    .navbar {
        padding: 0.6rem 0.75rem !important;
    }

    .nav-container {
        gap: 0.5rem;
    }

    /* Shrink logo on small screens */
    .logo img {
        height: 36px !important;
    }

    /* Tighten icon spacing */
    .nav-icons {
        gap: 0.25rem !important;
        flex-shrink: 0;
    }

    .icon-btn {
        font-size: 1.1rem !important;
        padding: 0.35rem !important;
    }

    /* Hide welcome pill text but keep the pill compact */
    .user-welcome {
        padding: 0.25rem 0.6rem !important;
        font-size: 0.8rem !important;
        gap: 0.3rem !important;
    }

    .welcome-text {
        display: none !important;
    }

    .username-highlight {
        font-size: 0.85rem !important;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Mobile menu button visible */
    .mobile-menu-btn {
        display: block !important;
        flex-shrink: 0;
    }

    /* Nav menu hidden on mobile */
    .nav-menu {
        display: none !important;
    }
}

@media (max-width: 480px) {
    /* On very small screens, hide the welcome pill entirely — user icon dropdown is sufficient */
    .user-welcome {
        display: none !important;
    }

    .nav-icons {
        gap: 0.15rem !important;
    }

    .icon-btn {
        padding: 0.3rem !important;
        font-size: 1rem !important;
    }
}

/* ── Hero section ── */
@media (max-width: 768px) {
    .hero {
        min-height: 85vh;
    }

    .hero-content {
        padding: 1.25rem;
    }

    .hero-title {
        font-size: clamp(1.8rem, 8vw, 2.8rem) !important;
    }

    .hero-title span {
        font-size: clamp(1.1rem, 4vw, 1.6rem) !important;
    }

    .hero-subtitle {
        font-size: 0.95rem !important;
        padding: 0 0.5rem;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .hero-cta .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

/* ── Search / filter section ── */
@media (max-width: 768px) {
    .search-section {
        margin-top: -20px !important;
        padding: 0 0.75rem !important;
    }

    .search-container {
        padding: 1.25rem !important;
        border-radius: 16px !important;
    }

    .search-form {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .search-group,
    .filter-select,
    .price-range,
    .search-btn {
        width: 100% !important;
        min-width: unset !important;
    }

    .price-range {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem;
    }

    .price-range .price-input {
        flex: 1;
    }
}

/* ── Products grid ── */
@media (max-width: 768px) {
    .products-section {
        padding: 0 0.75rem !important;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .product-carousel {
        height: 200px !important;
    }

    .product-info {
        padding: 0.75rem !important;
    }

    .product-title {
        font-size: 0.9rem !important;
    }

    .product-actions {
        gap: 0.4rem !important;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr !important;
    }

    .product-carousel {
        height: 240px !important;
    }

    .product-actions {
        grid-template-columns: 1fr !important;
    }

    .btn-quick-view {
        width: 100% !important;
    }
}

/* ── About / Features / Stats sections ── */
@media (max-width: 768px) {
    .about-grid,
    .contact-grid,
    .features-grid,
    .stats-grid,
    .modal-grid {
        grid-template-columns: 1fr !important;
    }

    .about-cta,
    .newsletter-form {
        flex-direction: column !important;
    }

    .about-cta .btn,
    .newsletter-form input,
    .newsletter-form button {
        width: 100% !important;
    }

    .newsletter-section {
        margin: 2rem 0.75rem !important;
        padding: 1.75rem !important;
    }
}

/* ── Cart page ── */
@media (max-width: 768px) {
    .main-content {
        padding: 0 0.75rem !important;
    }

    .cart-container {
        padding: 1.25rem !important;
    }

    .cart-table,
    .cart-table thead,
    .cart-table tbody,
    .cart-table tr,
    .cart-table td {
        display: block !important;
    }

    .cart-table thead {
        display: none !important;
    }

    .cart-table tr {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
        border-radius: 12px !important;
    }

    .cart-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.5rem !important;
    }

    .cart-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray, #64748B);
    }

    .quantity-control {
        width: 100% !important;
        justify-content: flex-end !important;
    }
}

/* ── Checkout / Order Now page ── */
@media (max-width: 1024px) {
    .checkout-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .checkout-card,
    .order-summary,
    .checkout-form {
        padding: 1.25rem !important;
    }

    .promo-group {
        flex-direction: column !important;
    }

    .promo-btn {
        width: 100% !important;
    }

    .product-item {
        gap: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .product-item {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .product-item .product-image {
        width: 100px !important;
        height: 100px !important;
    }
}

/* ── Profile page ── */
@media (max-width: 768px) {
    .profile-card {
        padding: 1.5rem !important;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .form-group.full-width {
        grid-column: span 1 !important;
    }

    .profile-pic-container {
        width: 110px !important;
        height: 110px !important;
    }
}

/* ── Order Tracking page ── */
@media (max-width: 768px) {
    .tracking-card {
        padding: 1.25rem !important;
    }

    .orders-grid {
        grid-template-columns: 1fr !important;
    }

    .filter-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── Wishlist page ── */
@media (max-width: 768px) {
    .wishlist-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    .wishlist-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── Footer ── */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr !important;
        text-align: center !important;
    }

    .social-links {
        justify-content: center !important;
    }

    .footer-content {
        flex-direction: column !important;
        text-align: center !important;
    }

    .footer-info {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }

    .footer h4::after {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

@media (max-width: 480px) {
    .footer-info {
        flex-direction: column !important;
        align-items: center !important;
    }
}

/* ── Modals / Toast ── */
@media (max-width: 768px) {
    .toast,
    .sq-toast {
        min-width: unset !important;
        width: calc(100% - 2rem) !important;
        top: 1rem !important;
        right: 1rem !important;
        left: 1rem !important;
    }

    .modal-content {
        margin: 1rem !important;
        max-height: calc(100vh - 2rem) !important;
        overflow-y: auto !important;
    }
}

/* ── Map overlay ── */
@media (max-width: 1024px) {
    .map-overlay {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
        margin: 2rem auto 0 !important;
        max-width: 90% !important;
    }

    .map-section {
        height: auto !important;
        padding: 2rem !important;
    }

    #location-map {
        height: 350px !important;
    }
}

/* ── Misc float button ── */
@media (max-width: 768px) {
    .whatsapp-float {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.4rem !important;
        bottom: 16px !important;
        right: 16px !important;
    }

    #back-to-top {
        bottom: 16px !important;
        right: 16px !important;
        width: 38px !important;
        height: 38px !important;
        font-size: 1.1rem !important;
    }
}

/* ── Section headers & titles ── */
@media (max-width: 480px) {
    .section-title {
        font-size: 1.6rem !important;
    }

    .hero-title {
        font-size: 1.8rem !important;
    }
}

/* ── Login / Register pages ── */
@media (max-width: 480px) {
    .login-card,
    .register-card,
    .auth-card {
        margin: 1rem !important;
        padding: 1.5rem !important;
    }

    .toast-notification {
        min-width: unset !important;
        width: calc(100% - 2rem) !important;
        right: 1rem !important;
        left: 1rem !important;
    }
}

/* ── Order history ── */
@media (max-width: 768px) {
    .order-history-table,
    .order-history-table thead,
    .order-history-table tbody,
    .order-history-table tr,
    .order-history-table td,
    .order-history-table th {
        display: block !important;
    }

    .order-history-table thead {
        display: none !important;
    }

    .order-history-table tr {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        border: 1px solid rgba(139, 92, 246, 0.15) !important;
    }

    .order-history-table td {
        display: flex !important;
        justify-content: space-between !important;
        padding: 0.5rem !important;
        border-bottom: 1px solid rgba(139, 92, 246, 0.08) !important;
    }

    .order-history-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray, #64748B);
    }
}
