/**
 * Shoesland — بهینه‌سازی موبایل و تبلت
 */

/* ─── پایه و safe area ─── */
@supports (padding: max(0px)) {
    .navbar {
        padding-top: max(0px, env(safe-area-inset-top));
    }
    .cart-footer,
    .footer-bottom {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ─── موبایل (تا ۷۶۷px) ─── */
@media (max-width: 767px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 12px;
    }

    /* نوار بالا */
    .nav-container {
        padding: 10px 12px;
        gap: 6px;
    }

    .logo {
        font-size: 17px;
        gap: 6px;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logo-icon {
        font-size: 22px;
        flex-shrink: 0;
    }

    .nav-right {
        gap: 4px;
        flex-shrink: 0;
    }

    .icon-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        font-size: 17px;
    }

    .btn-login span,
    #userName {
        display: none !important;
    }

    .btn-login {
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 0;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
    }

    .user-menu {
        gap: 4px;
        flex-wrap: nowrap;
    }

    .user-menu .icon-btn,
    .user-menu .account-panel-btn,
    .user-menu a.icon-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
        font-size: 15px;
        padding: 0;
    }

    .btn-logout {
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-logout i {
        margin: 0;
    }

    /* هیرو موبایل */
    .mobile-hero-slider {
        height: 100svh;
        height: 100dvh;
        max-height: -webkit-fill-available;
    }

    .hero {
        min-height: 0;
        padding: 0;
    }

    .slider-overlay {
        padding: 32px 16px 100px;
    }

    .slider-logo {
        padding-top: 48px;
    }

    .slider-logo .logo {
        font-size: 36px;
    }

    .slider-cta h2 {
        font-size: 22px;
    }

    /* محصولات */
    .products {
        padding: 36px 0 48px;
    }

    .section-title {
        font-size: 1.35rem;
        margin-bottom: 20px;
    }

    .section-header {
        margin-bottom: 24px;
    }

    .section-header .section-title {
        text-align: center;
        font-size: 1.2rem;
    }

    .filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        margin: 0 -12px;
        padding: 4px 12px 10px;
        scroll-snap-type: x proximity;
    }

    .filter-btn {
        scroll-snap-align: start;
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 11px;
        min-height: 38px;
    }

    .products-grid {
        gap: 10px;
    }

    .product-info {
        padding: 10px;
    }

    .product-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }

    .product-price {
        font-size: 14px;
    }

    .product-category {
        font-size: 10px;
    }

    .load-more .btn {
        width: 100%;
        justify-content: center;
    }

    /* ویژگی‌ها */
    .features {
        padding: 40px 0;
    }

    .features-grid {
        gap: 12px;
    }

    .feature-item {
        padding: 20px 12px;
    }

    .feature-item h3 {
        font-size: 14px;
    }

    /* خبرنامه */
    .newsletter {
        padding: 40px 0;
    }

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

    .newsletter-form .btn {
        width: 100%;
    }

    /* فوتر */
    .footer {
        padding: 40px 0 0;
    }

    .footer-grid {
        gap: 28px;
        text-align: center;
    }

    .footer-col .logo {
        justify-content: center;
    }

    .footer-col h4::after {
        right: 50%;
        transform: translateX(50%);
    }

    .footer-col ul li a:hover {
        padding-right: 0;
    }

    .contact-info li {
        justify-content: center;
        flex-wrap: wrap;
    }

    .social-links-branded {
        justify-content: center;
    }

    .social-links-branded .social-btn::after {
        bottom: auto;
        top: calc(100% + 6px);
        transform: translateX(50%);
        font-size: 11px;
    }

    .footer-bottom {
        padding: 20px 12px;
        font-size: 12px;
        line-height: 1.7;
    }

    .footer-bottom p {
        margin-bottom: 6px;
    }

    /* راهنمای سایز */
    .size-guide-home {
        padding: 36px 0;
    }

    .size-guide-home-header .section-title {
        font-size: 1.25rem;
    }

    .size-guide-table-wrap--home {
        max-width: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
    }

    .size-guide-table {
        font-size: 13px;
        min-width: 260px;
    }

    .size-guide-table th,
    .size-guide-table td {
        padding: 10px 12px;
    }

    .size-guide-page-header {
        padding: 88px 16px 28px;
    }

    .size-guide-page-header h1 {
        font-size: 1.4rem;
    }

    /* هاب زیردسته */
    .category-hub-section {
        padding: 16px 0 40px;
    }

    .category-hub-title {
        font-size: 1.35rem;
    }

    .category-hub-grid {
        gap: 12px;
    }

    /* جستجو — تمام‌صفحه */
    .search-panel-overlay {
        padding: 0;
        align-items: stretch;
    }

    .search-panel {
        margin: 0;
        max-width: none;
        width: 100%;
        min-height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .search-panel-top {
        padding: max(16px, env(safe-area-inset-top)) 16px 0;
    }

    .search-panel-header {
        margin: 16px 12px 0;
    }

    .search-panel-results {
        max-height: none;
        flex: 1;
    }

    .search-panel-tagline {
        font-size: 1rem;
    }

    /* سبد خرید */
    .cart-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .cart-item-img {
        width: 72px;
        height: 72px;
    }

    .cart-item-title {
        white-space: normal;
        font-size: 14px;
    }

    .discount-input-group {
        flex-direction: column;
        gap: 8px;
    }

    .discount-btn {
        width: 100%;
    }

    .toast {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: max(16px, env(safe-area-inset-bottom));
    }

    /* صفحه محصول */
    .product-detail-section {
        padding: 88px 0 40px;
    }

    .breadcrumb {
        font-size: 12px;
        gap: 6px;
    }

    .product-actions-detail {
        flex-direction: column;
    }

    .product-actions-detail .btn {
        width: 100%;
    }

    .size-options-detail,
    .color-options-detail {
        gap: 8px;
    }

    .size-option-detail {
        min-width: 44px;
        height: 44px;
        font-size: 13px;
    }

    /* فیلتر شده */
    .filtered-header {
        padding: 88px 12px 24px !important;
    }

    .filtered-page-title,
    #pageTitle {
        font-size: 1.3rem !important;
        line-height: 1.35;
    }

    .breadcrumb-nav {
        font-size: 12px;
    }

    .sub-filters {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        max-width: 100%;
    }

    .sub-filter-btn {
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    .products-grid-full {
        gap: 12px;
        padding: 0 12px !important;
    }

    /* هدر صفحات داخلی */
    .filtered-page-header,
    .shops-page-header {
        padding: 88px 16px 28px !important;
    }

    .filtered-page-title {
        font-size: 1.35rem !important;
    }

    /* فروشگاه */
    .category-section {
        padding: 28px 0;
    }

    .category-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 0 12px !important;
    }

    .category-title {
        font-size: 1.15rem;
    }

    .view-all-btn {
        width: 100%;
        justify-content: center;
    }

    .products-scroll .product-card {
        min-width: 200px;
        max-width: 200px;
    }

    .scroll-nav {
        display: none !important;
    }

    /* حساب کاربری */
    .account-main,
    .support-main {
        padding: 88px 0 40px !important;
    }

    .account-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .account-toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    .order-meta {
        flex-direction: column;
        gap: 6px;
    }

    /* تسویه */
    .checkout-wrap {
        margin: 24px auto !important;
        padding: 0 12px 32px !important;
    }

    .checkout-card {
        padding: 20px 16px !important;
        border-radius: 16px !important;
    }

    /* منوی موبایل */
    .mobile-menu {
        width: min(92vw, 320px);
        padding-top: max(80px, calc(60px + env(safe-area-inset-top)));
    }

    .mobile-link {
        font-size: 16px;
        padding: 16px 0;
    }

    /* اسکلتون بارگذاری */
    .catalog-loading-state {
        padding: 24px 12px;
    }
}

/* ─── گوشی‌های خیلی کوچک ─── */
@media (max-width: 380px) {
    .logo span:not(.logo-icon) {
        display: none;
    }

    .user-menu a[href*='support'] {
        display: none;
    }

    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .category-hub-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .filter-btn {
        padding: 6px 10px;
        font-size: 10px;
    }
}

/* ─── تبلت (۷۶۸ تا ۱۰۲۳) ─── */
@media (min-width: 768px) and (max-width: 1023px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .category-hub-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* لمس: بدون هاور sticky روی iOS */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover {
        transform: none;
    }

    .category-card:hover {
        transform: none;
    }

    .category-hub-chip:hover,
    .sub-filter-btn:hover {
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Shoesland Mobile v2 — بهبود جامع تمام صفحات
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    /* جلوگیری از اسکرول افقی */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    img,
    video,
    svg {
        max-width: 100%;
        height: auto;
    }

    /* iOS: بدون زوم هنگام فوکوس input */
    input,
    select,
    textarea,
    .discount-input {
        font-size: 16px !important;
    }

    /* سبد — تمام‌عرض + safe area */
    .cart-sidebar {
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        height: 100svh;
    }

    .cart-header {
        padding: max(14px, env(safe-area-inset-top)) 16px 14px;
    }

    .cart-footer {
        padding: 16px 16px max(20px, env(safe-area-inset-bottom));
    }

    .checkout-btn {
        min-height: 52px;
        font-size: 16px;
    }

    /* صفحه محصول — چیدمان موبایل + دکمه ثابت پایین */
    .product-detail-section {
        padding: 76px 0 120px !important;
    }

    .product-detail-section .container {
        padding: 0 12px;
    }

    .product-detail-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        grid-template-columns: unset !important;
    }

    .product-main-image-col {
        order: 1;
        position: static !important;
        width: 100%;
    }

    .product-main-image-col .main-image-container {
        max-height: min(72vw, 420px);
        border-radius: 14px;
    }

    .product-thumbs-col {
        order: 2;
        width: 100%;
    }

    .product-detail-info {
        order: 3;
        width: 100%;
        padding: 0 !important;
    }

    .product-thumbs-col .thumbnail-container {
        flex-direction: row !important;
        overflow-x: auto;
        max-height: none !important;
        gap: 8px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .product-thumbs-col .thumbnail {
        width: 64px !important;
        height: 64px !important;
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    .product-detail-info .product-title,
    .product-detail-info h1 {
        font-size: 1.25rem !important;
        line-height: 1.4;
    }

    .product-detail-info .product-price,
    .product-detail-price {
        font-size: 1.35rem !important;
    }

    .size-grid-detail {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }

    .pd-size-cell {
        height: 46px !important;
        font-size: 0.88rem !important;
        min-height: 44px;
    }

    .color-options-detail {
        gap: 8px;
    }

    .pd-color-swatch {
        width: 44px !important;
        height: 44px !important;
    }

    /* دکمه‌های خرید — نوار ثابت پایین صفحه */
    .product-actions-detail {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 950;
        margin: 0 !important;
        padding: 12px 16px max(14px, env(safe-area-inset-bottom)) !important;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.12);
        gap: 8px !important;
    }

    .btn-add-cart-detail,
    .btn-wishlist-detail {
        min-height: 48px;
    }

    .product-specs-grid,
    .specs-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    /* فروشگاه — اسکرول افقی محصولات */
    .products-scroll,
    .products-row {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        gap: 12px;
        padding: 4px 12px 16px;
        margin: 0 -12px;
    }

    .products-scroll .product-card,
    .products-row .product-card {
        flex: 0 0 168px;
        min-width: 168px;
        max-width: 168px;
        scroll-snap-align: start;
    }

    /* دسته‌های سریع صفحه اصلی */
    .category-quick-links {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin: 20px 0 !important;
    }

    .category-card {
        padding: 22px 14px !important;
        min-height: 44px;
    }

    /* تسویه حساب */
    .checkout-wrap {
        margin-top: 16px !important;
    }

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

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

    /* حساب / پشتیبانی */
    .support-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .support-card,
    .order-card-acc {
        padding: 16px !important;
    }

    .ticket-list,
    .order-list {
        max-height: none;
    }

    /* تأیید پرداخت */
    .verify-card {
        padding: 28px 18px !important;
        border-radius: 16px !important;
    }

    .verify-card h1 {
        font-size: 1.2rem !important;
    }

    .verify-actions {
        flex-direction: column;
        gap: 10px;
    }

    .verify-actions .btn,
    .verify-actions a {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    /* درباره ما */
    .about-hero,
    .about-section {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* هاب زیردسته */
    .category-hub-chips-scroll {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 4px 12px 14px;
        scroll-snap-type: x proximity;
    }

    .category-hub-chip {
        flex: 0 0 auto;
        scroll-snap-align: start;
        min-width: 96px;
    }

    /* overlay منو */
    .overlay.active {
        backdrop-filter: blur(4px);
    }

    /* دکمه‌ها — حداقل ناحیه لمس */
    .btn,
    .sub-filter-btn,
    .filter-btn,
    .view-all-btn,
    .checkout-btn,
    button[type='submit'] {
        min-height: 44px;
    }
}

/* صفحه ورود (login/login.html) */
@media (max-width: 767px) {
    body:has(.auth-card),
    body:has(.login-card) {
        padding: max(12px, env(safe-area-inset-top)) 12px
            max(12px, env(safe-area-inset-bottom));
        align-items: flex-start;
        padding-top: 24px;
    }

    .auth-card,
    .login-card,
    .card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto;
        padding: 24px 18px !important;
        border-radius: 20px !important;
    }

    .brand h1 {
        font-size: 1.35rem !important;
    }

    .otp-inputs {
        gap: 8px !important;
    }

    .otp-inputs input {
        width: 44px !important;
        height: 52px !important;
        font-size: 1.25rem !important;
    }
}

@media (max-width: 480px) {
    .products-grid,
    .products-grid-full {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .size-grid-detail {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .product-actions-detail .btn-wishlist-detail {
        display: none;
    }

    .product-actions-detail .btn-add-cart-detail {
        width: 100%;
    }

    .slider-logo .logo {
        font-size: 28px !important;
    }

    .slider-cta h2 {
        font-size: 18px !important;
    }
}

/* تبلت — سبد و گرید */
@media (min-width: 768px) and (max-width: 1023px) {
    .cart-sidebar {
        width: min(420px, 92vw);
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .products-grid-full {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .product-detail-container {
        grid-template-columns: 1fr 1fr !important;
        gap: 20px !important;
    }

    .product-thumbs-col {
        grid-column: 1 / -1;
    }

    .product-thumbs-col .thumbnail-container {
        flex-direction: row !important;
        overflow-x: auto;
        max-height: none !important;
    }
}
