/* ===================================================
   LIFTCULTURE — FULL RESPONSIVE CSS
   Breakpoints:
   xs:  < 480px   (küçük telefon)
   sm:  480–767px (büyük telefon)
   md:  768–1023px (tablet)
   lg:  1024–1279px (küçük laptop)
   xl:  1280px+   (masaüstü)
   fold: 280–360px (katlanır telefon)
=================================================== */

/* ===== FOLD / ULTRA SMALL (280-360px) ===== */
@media (max-width: 360px) {
  :root { --radius: 6px; --radius-lg: 10px; }

  .container { padding: 0 12px; }

  .brand-logo { font-size: 18px; }
  .navbar-inner { padding: 12px; gap: 10px; }

  .header-top .container { gap: 8px; font-size: 10px; flex-wrap: wrap; justify-content: center; }
  .header-top span:last-child { display: none; }

  .hero h1 { font-size: 26px; letter-spacing: -1px; }
  .hero p { font-size: 14px; }
  .hero-stats { gap: 16px; flex-wrap: wrap; }
  .hero-stat-value { font-size: 22px; }

  .products-grid { grid-template-columns: 1fr; gap: 10px; }
  .product-card-body { padding: 12px; }
  .price-current { font-size: 16px; }

  .cart-item { grid-template-columns: 64px 1fr auto; gap: 10px; }
  .cart-item-image { width: 64px; height: 64px; }

  .section-title { font-size: 20px; }
  .categories-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .category-card { padding: 16px 10px; }
  .category-card i { font-size: 22px; }

  .btn-lg { padding: 12px 20px; font-size: 14px; }
  .form-row { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr; gap: 24px; padding: 32px 12px; }
  .footer-bottom .container { flex-direction: column; gap: 10px; text-align: center; }

  .macro-result { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .macro-item { padding: 14px; }
  .macro-value { font-size: 22px; }

  .product-detail-layout { grid-template-columns: 1fr; }
  .shop-layout { grid-template-columns: 1fr; }
  .checkout-layout { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
}

/* ===== EXTRA SMALL (360-480px) ===== */
@media (min-width: 361px) and (max-width: 479px) {
  .container { padding: 0 16px; }

  .hero h1 { font-size: 30px; }
  .hero-stats { gap: 20px; }

  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .categories-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }

  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ===== SMALL — tüm telefonlar (< 768px) ===== */
@media (max-width: 767px) {

  /* HEADER */
  .header-top { padding: 6px 0; }
  .header-top .container { gap: 12px; font-size: 11px; }

  .navbar-inner { padding: 12px 16px; gap: 12px; }
  .nav-search { display: none; }
  .nav-categories { display: none; }
  .mobile-menu-toggle { display: flex; }

  /* HERO */
  .hero { padding: 48px 0 40px; }
  .hero::before { width: 100%; opacity: 0.5; }
  .hero h1 { font-size: clamp(28px, 8vw, 40px); letter-spacing: -1px; }
  .hero p { font-size: 15px; }
  .hero-actions { flex-direction: column; gap: 10px; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-stats { gap: 24px; padding-top: 32px; margin-top: 32px; flex-wrap: wrap; }
  .hero-stat-value { font-size: 24px; }
  .hero-stat-label { font-size: 12px; }

  /* SECTIONS */
  .section { padding: 40px 0; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-title { font-size: 22px; }

  /* CATEGORIES */
  .categories-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .category-card { padding: 16px 8px; }
  .category-card i { font-size: 22px; margin-bottom: 8px; }
  .category-card span { font-size: 11px; }

  /* PRODUCTS */
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-card-body { padding: 12px; }
  .product-name { font-size: 13px; }
  .price-current { font-size: 17px; }
  .product-brand { font-size: 10px; }

  /* SHOP LAYOUT */
  .shop-layout { grid-template-columns: 1fr; gap: 16px; padding: 20px 0; }
  .filters-sidebar { position: static; }
  .shop-header { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* PRODUCT DETAIL */
  .product-detail { padding: 24px 0; }
  .product-detail-layout { grid-template-columns: 1fr; gap: 24px; }
  .product-gallery { position: static; }
  .product-info-name { font-size: 20px; }
  .product-info-price { font-size: 28px; }
  .product-actions { flex-wrap: wrap; }
  .product-actions .btn-primary { flex: 1; min-width: 0; }
  .gallery-thumbs { gap: 6px; }
  .gallery-thumb { width: 56px; height: 56px; }

  /* CART */
  .cart-page { padding: 24px 0; }
  .cart-layout { grid-template-columns: 1fr; gap: 20px; }
  .cart-item { grid-template-columns: 72px 1fr; gap: 12px; }
  .cart-item-price { grid-column: 2; font-size: 16px; }
  .cart-summary { position: static; }

  /* CHECKOUT */
  .checkout-layout { grid-template-columns: 1fr; gap: 20px; padding: 24px 0; }
  .checkout-section { padding: 16px; }

  /* FOOTER */
  .footer-grid { grid-template-columns: 1fr; gap: 28px; padding: 40px 16px; }
  .footer-bottom .container { flex-direction: column; gap: 12px; text-align: center; }
  .payment-icons { justify-content: center; }
  .social-links { justify-content: flex-start; }

  /* FORMS */
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .calculator-card { padding: 20px; }
  .macro-result { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* TABS */
  .tab-nav { overflow-x: auto; scrollbar-width: none; }
  .tab-btn { padding: 10px 14px; font-size: 13px; white-space: nowrap; }

  /* REVIEW */
  .review-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* PAGINATION */
  .pagination { gap: 4px; }
  .page-btn { width: 34px; height: 34px; font-size: 13px; }

  /* PROMO BANNER */
  section[style*="background: var(--accent)"] .container,
  section[style*="background:var(--accent)"] .container {
    flex-direction: column;
    text-align: center;
  }

  /* FITNESS */
  .fitness-grid { grid-template-columns: 1fr; }

  /* WISHLIST / HISTORY */
  .order-card-row { flex-direction: column; gap: 12px; }

  /* TOAST */
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: unset; }

  /* MOBILE SEARCH BAR — show in mobile menu */
  .mobile-search { display: block; padding: 12px 16px; border-bottom: 1px solid var(--dark-3); }
  .mobile-search form { display: flex; background: var(--dark-2); border: 1px solid var(--dark-3); border-radius: var(--radius); overflow: hidden; }
  .mobile-search input { flex: 1; background: none; border: none; padding: 10px 14px; color: var(--white); font-size: 14px; outline: none; }
  .mobile-search button { padding: 10px 14px; color: var(--gray); }
}

/* ===== TABLET (768px - 1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
  .container { padding: 0 24px; }

  .nav-search { max-width: 300px; }
  .nav-categories .container { gap: 0; }
  .nav-categories a { padding: 10px 12px; font-size: 12px; }

  .hero h1 { font-size: 44px; }
  .hero-stats { gap: 32px; }

  .products-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .categories-grid { grid-template-columns: repeat(4, 1fr); }

  .shop-layout { grid-template-columns: 220px 1fr; gap: 20px; }
  .product-detail-layout { grid-template-columns: 1fr 1fr; gap: 32px; }
  .cart-layout { grid-template-columns: 1fr 300px; }
  .checkout-layout { grid-template-columns: 1fr 300px; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }

  .macro-result { grid-template-columns: repeat(4, 1fr); }

  /* Admin */
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
  .adm-grid-2 { grid-template-columns: 1fr; }
  .adm-grid-2-1 { grid-template-columns: 1fr; }
  .adm-grid-1-2 { grid-template-columns: 1fr; }
}

/* ===== SMALL LAPTOP (1024px - 1279px) ===== */
@media (min-width: 1024px) and (max-width: 1279px) {
  .container { padding: 0 24px; }
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; }
}

/* ===== TOUCH IMPROVEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
  /* Bigger tap targets */
  .nav-btn { width: 44px; height: 44px; }
  .qty-btn { width: 36px; height: 36px; }
  .adm-btn { min-height: 40px; }
  .btn { min-height: 44px; }

  /* Remove hover effects that don't work on touch */
  .product-card:hover { transform: none; }
  .product-card:hover .product-card-image img { transform: none; }
  .btn-primary:hover { transform: none; }

  /* Active states instead */
  .product-card:active { transform: scale(0.98); }
  .btn:active { transform: scale(0.97); }
  .nav-btn:active { background: var(--dark-2); }
}

/* ===== FOLDABLE PHONE SUPPORT ===== */
@media (max-width: 280px) {
  .container { padding: 0 8px; }
  .brand-logo { font-size: 16px; }
  .hero h1 { font-size: 22px; }
  .products-grid { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { flex-direction: column; gap: 12px; }
  .nav-actions { gap: 4px; }
  .nav-btn { width: 36px; height: 36px; }
}

/* ===== LANDSCAPE PHONE ===== */
@media (max-width: 767px) and (orientation: landscape) {
  .hero { padding: 32px 0; }
  .hero h1 { font-size: 28px; }
  .hero-stats { display: none; }
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .categories-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ===== LARGE FOLDABLE (unfolded ~720px) ===== */
@media (min-width: 600px) and (max-width: 767px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .categories-grid { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 36px; }
  .hero-actions { flex-direction: row; }
}

/* ===== UTILITY: hide/show ===== */
.hide-mobile { }
.show-mobile { display: none; }

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
  .show-mobile-flex { display: flex !important; }
}

/* ===== SAFE AREA (iPhone notch/home bar) ===== */
@supports (padding: max(0px)) {
  .site-header { padding-top: env(safe-area-inset-top); }
  .site-footer { padding-bottom: env(safe-area-inset-bottom); }
  .mobile-menu { padding-top: env(safe-area-inset-top); }
}

/* ===== SMOOTH SCROLL SNAP for product grid on mobile ===== */
@media (max-width: 767px) {
  .products-grid {
    scroll-snap-type: none; /* grid, no snap needed */
  }

  /* Sticky bottom cart button on mobile */
  .cart-sticky-mobile {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--dark);
    border-top: 1px solid var(--dark-3);
    z-index: 90;
    display: flex;
    gap: 10px;
  }
  .cart-sticky-mobile .btn { flex: 1; }
}

/* ===== FILTER SIDEBAR MOBILE DRAWER ===== */
@media (max-width: 767px) {
  .filters-sidebar {
    background: var(--dark-2);
    border: 1px solid var(--dark-3);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
  }

  .filter-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: var(--dark-2);
    border: 1px solid var(--dark-3);
    border-radius: var(--radius);
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    cursor: pointer;
  }

  .filter-body { display: none; }
  .filter-body.open { display: block; }
}

@media (min-width: 768px) {
  .filter-toggle-btn { display: none; }
  .filter-body { display: block !important; }
}

/* ===== NAVBAR MOBILE SEARCH ===== */
@media (max-width: 767px) {
  .mobile-search { display: block; }
}
@media (min-width: 768px) {
  .mobile-search { display: none; }
}

/* ===== PRODUCT DETAIL MOBILE ===== */
@media (max-width: 767px) {
  .product-detail .container { padding: 0 12px; }
  .variant-options { gap: 6px; }
  .variant-option { padding: 7px 12px; font-size: 12px; }
  .nutrition-table { font-size: 13px; }
  .nutrition-row { padding: 8px 12px; }
  .tabs { margin-top: 24px; }
}

/* ===== CART MOBILE ===== */
@media (max-width: 767px) {
  .cart-item-name { font-size: 13px; }
  .cart-item-variant { font-size: 11px; }
  .cart-item-price { font-size: 15px; }
  .qty-control { gap: 6px; }
  .cart-summary h3 { font-size: 16px; }
  .summary-row { font-size: 13px; }
  .summary-row.total { font-size: 16px; }
  .coupon-form { flex-direction: column; }
  .coupon-form input { width: 100%; }
}

/* ===== ACCOUNT / PROFILE MOBILE ===== */
@media (max-width: 767px) {
  .profile-layout { grid-template-columns: 1fr !important; }
  .profile-layout > div:first-child { order: 2; }
  .profile-layout > div:last-child { order: 1; }
}

/* ===== FITNESS CALCULATOR MOBILE ===== */
@media (max-width: 767px) {
  .calculator-card { padding: 16px; border-radius: var(--radius); }
  .macro-item { padding: 14px 10px; }
  .macro-value { font-size: 22px; }
  .macro-label { font-size: 11px; }
}

/* ===== WORKOUT PLANS MOBILE ===== */
@media (max-width: 767px) {
  .plan-card { margin-bottom: 12px; }
}

/* ===== ORDER HISTORY MOBILE ===== */
@media (max-width: 767px) {
  .order-card { padding: 16px; }
  .order-card-header { flex-direction: column; gap: 10px; }
  .order-items-preview { flex-wrap: wrap; gap: 6px; }
}

/* ===== LOGIN / REGISTER MOBILE ===== */
@media (max-width: 767px) {
  .auth-wrapper { padding: 24px 16px; }
  .auth-card { padding: 24px 20px; }
}

/* ===== MOBILE MENU IMPROVEMENTS ===== */
@media (max-width: 767px) {
  .mobile-menu { width: min(280px, 85vw); }
  .mobile-menu-header { font-size: 18px; }
  .mobile-nav a { padding: 14px 20px; font-size: 15px; }
}

/* ===== BOTTOM NAV BAR (mobile) ===== */
@media (max-width: 767px) {
  .bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--dark);
    border-top: 1px solid var(--dark-3);
    display: flex;
    z-index: 95;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    font-size: 10px;
    color: var(--gray);
    gap: 4px;
    transition: color 0.2s;
  }
  .bottom-nav a i { font-size: 18px; }
  .bottom-nav a.active, .bottom-nav a:hover { color: var(--accent); }
  .bottom-nav a .cart-badge {
    position: absolute;
    top: 6px;
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 9px;
    font-weight: 700;
    width: 14px; height: 14px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
  }

  /* Push content above bottom nav */
  .main-content { padding-bottom: 64px; }
  .site-footer { margin-bottom: 64px; }
}

@media (min-width: 768px) {
  .bottom-nav { display: none; }
}

/* ===== SCROLLBAR MOBILE ===== */
@media (max-width: 767px) {
  ::-webkit-scrollbar { width: 0; height: 0; }
}

/* ===== IMAGE OPTIMIZATION ===== */
@media (max-width: 767px) {
  .product-card-image { aspect-ratio: 1; }
  .gallery-main { aspect-ratio: 1; }
}

/* ===== TYPOGRAPHY SCALE ===== */
@media (max-width: 767px) {
  h1 { font-size: clamp(22px, 6vw, 32px); }
  h2 { font-size: clamp(18px, 5vw, 26px); }
  h3 { font-size: clamp(15px, 4vw, 20px); }
}

/* ===== PREVENT HORIZONTAL SCROLL ===== */
html, body { overflow-x: hidden; max-width: 100vw; }
.container { overflow-x: hidden; }

/* ===== HOME PAGE SPECIFIC ===== */
@media (max-width: 767px) {
  .fitness-grid { grid-template-columns: 1fr !important; }
  .fitness-grid > div:first-child { order: 2; }
  .fitness-grid > div:last-child { order: 1; }

  /* Hero stats row */
  .hero-stats { flex-wrap: wrap; }
  .hero-stats > div { min-width: 80px; }

  /* Promo banner */
  section[style*="background: var(--accent)"] .container {
    flex-direction: column !important;
    text-align: center;
    gap: 16px !important;
  }
  section[style*="background: var(--accent)"] .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===== PRODUCT DETAIL SPECIFIC ===== */
@media (max-width: 767px) {
  /* Sticky add to cart on product detail */
  .product-actions-sticky {
    position: fixed;
    bottom: 64px; /* above bottom nav */
    left: 0; right: 0;
    padding: 10px 16px;
    background: var(--dark);
    border-top: 1px solid var(--dark-3);
    z-index: 89;
    display: flex;
    gap: 10px;
  }
  .product-actions-sticky .btn { flex: 1; }
}

/* ===== CART SPECIFIC ===== */
@media (max-width: 767px) {
  .cart-item { padding: 14px 0; }
  .cart-item-image { width: 68px; height: 68px; border-radius: 8px; }
  .qty-btn { width: 30px; height: 30px; font-size: 14px; }
}

/* ===== CHECKOUT SPECIFIC ===== */
@media (max-width: 767px) {
  .checkout-layout > div:last-child { order: -1; } /* summary first on mobile */
}

/* ===== ACCOUNT PROFILE ===== */
@media (max-width: 767px) {
  /* Profile grid */
  div[style*="grid-template-columns:1fr 2fr"],
  div[style*="grid-template-columns: 1fr 2fr"] {
    display: flex !important;
    flex-direction: column !important;
  }
}

/* ===== ORDER HISTORY ===== */
@media (max-width: 767px) {
  /* Order card inner flex */
  .card > div[style*="display:flex"][style*="justify-content:space-between"] {
    flex-direction: column;
    gap: 12px;
  }
}

/* ===== WORKOUT PLANS ===== */
@media (max-width: 767px) {
  /* Plan detail grid */
  div[style*="grid-template-columns:1fr 300px"],
  div[style*="grid-template-columns: 1fr 300px"] {
    display: flex !important;
    flex-direction: column !important;
  }
}

/* ===== ADMIN RESPONSIVE ===== */
@media (max-width: 900px) {
  .adm-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .adm-grid-2 { grid-template-columns: 1fr !important; }
  .adm-grid-2-1 { grid-template-columns: 1fr !important; }
  .adm-grid-1-2 { grid-template-columns: 1fr !important; }
  .adm-grid-3 { grid-template-columns: 1fr 1fr !important; }
  .adm-form-row { grid-template-columns: 1fr !important; }
  .adm-form-row-3 { grid-template-columns: 1fr !important; }
  .adm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 600px) {
  .adm-stats { grid-template-columns: 1fr 1fr !important; }
  .adm-stat-value { font-size: 22px; }
  .adm-topbar-title small { display: none; }
  .adm-content { padding: 16px; }
}

/* ===== GLOBAL INLINE GRID OVERRIDES FOR MOBILE ===== */
@media (max-width: 767px) {
  /* Any 2-col grid with inline style */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* 320px wide cards on mobile */
  [style*="max-width:420px"],
  [style*="max-width: 420px"],
  [style*="max-width:480px"],
  [style*="max-width: 480px"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Prevent overflow from fixed widths */
  [style*="width:320px"],
  [style*="width: 320px"],
  [style*="width:360px"],
  [style*="width: 360px"] {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ===== FONT SIZE CLAMP ===== */
@media (max-width: 767px) {
  [style*="font-size:36px"], [style*="font-size: 36px"] { font-size: clamp(22px, 6vw, 36px) !important; }
  [style*="font-size:28px"], [style*="font-size: 28px"] { font-size: clamp(20px, 5vw, 28px) !important; }
  [style*="font-size:24px"], [style*="font-size: 24px"] { font-size: clamp(18px, 4.5vw, 24px) !important; }
}

/* ===== TOUCH SCROLL IMPROVEMENTS ===== */
.nav-categories .container,
.gallery-thumbs,
.variant-options,
.adm-tabs {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* ===== FOCUS VISIBLE (accessibility) ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .bottom-nav, .mobile-menu { display: none; }
  .main-content { padding: 0; }
  body { background: white; color: black; }
}
