/*
Theme Name: Novoshop
Theme URI: https://example.com/novoshop
Author: Your Name
Description: قالب فروشگاهی نمونه Novoshop — پشتیبانی از WooCommerce و پنل تنظیمات ساده (موبایل-ریسپانسیو، RTL tuned)
Version: 1.1
Text Domain: novoshop
Tags: ecommerce, shop, woocommerce, rtl
*/

/* Import a Persian-friendly webfont (Vazirmatn) if available */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;600;700&display=swap');

:root{
  --primary:var(--primary-color, #ff6600);
  --text:#222;
  --muted:#6b7280;
  --container:1180px;
  --gap:18px;
  --radius:8px;
}

/* RTL tuning */
html[dir="rtl"]{ direction: rtl; }

/* Base */
body{ font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; color:var(--text); line-height:1.6; margin:0; background:#f7f7f8; }
.container{ max-width:var(--container); margin:0 auto; padding:0 16px; box-sizing:border-box; }

/* Header */
.site-header{ background:#fff; border-bottom:1px solid #eee; padding:14px 0; position:relative; z-index:60; }
.logo img{ height:44px; display:block; }
.header-right{ float:left; } /* will be reversed by RTL */

/* Clearfix */
.clearfix::after{ content:''; display:block; clear:both; }

/* Navigation */
.main-navigation{ position:relative; }
.main-navigation ul{ list-style:none; margin:0; padding:0; display:flex; gap:12px; align-items:center; }
.main-navigation a{ display:block; padding:12px 14px; text-decoration:none; color:var(--text); font-weight:600; }

/* Mega menu */
.main-navigation .novoshop-mega{ position:absolute; left:0; right:0; display:none; background:#fff; box-shadow:0 6px 20px rgba(0,0,0,0.06); padding:18px; }
.main-navigation li{ position:relative; }

/* Product grid */
.products-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:var(--gap); margin:24px 0; }
.product-card{ background:#fff; border:1px solid #eee; padding:12px; border-radius:8px; transition:box-shadow .18s ease; }
.product-card:hover{ box-shadow:0 8px 24px rgba(0,0,0,0.06); }
.product-card img{ max-width:100%; height:auto; display:block; border-radius:6px; }
.product-title{ font-size:15px; margin:10px 0; color:var(--text); min-height:38px; }
.price{ font-weight:700; color:var(--primary); font-size:16px; }

/* Single product */
.novoshop-product-single{ display:flex; gap:32px; padding:28px 0; align-items:flex-start; }
.product-left{ width:48%; }
.product-right{ width:52%; }
.product-price{ font-size:22px; font-weight:700; color:var(--primary); margin:8px 0; }
.product-short-desc{ color:var(--muted); margin:12px 0; }

/* Gallery thumbs */
.product-gallery .gallery-thumbs{ display:flex; gap:8px; margin-top:12px; }
.product-gallery .gallery-thumbs img{ cursor:pointer; width:72px; height:72px; object-fit:cover; border-radius:6px; border:1px solid #eee; }

/* Filters */
.shop-container{ display:flex; gap:24px; padding:24px 0; }
.shop-filters{ width:280px; flex:0 0 280px; background:#fff; padding:16px; border:1px solid #eee; border-radius:8px; height:fit-content; }
.shop-products{ flex:1; }

/* Buttons */
button, .button{ background:var(--primary); color:#fff; border:none; padding:10px 14px; border-radius:6px; cursor:pointer; font-weight:600; }

/* ============================================
   RESPONSIVE DESIGN SYSTEM
   ============================================ */

/* Mobile First Base Styles (320px+) */
/* Base mobile styles are already defined above */

/* Small Mobile (320px - 479px) */
@media (max-width: 479px) {
  /* Typography */
  body { font-size: 14px; line-height: 1.5; }
  
  /* Container */
  .container { padding: 0 12px; }
  
  /* Header Mobile */
  .site-header { padding: 8px 0; }
  .header-logo img { max-height: 35px; }
  
  /* Product Grid Mobile */
  .products-grid { 
    grid-template-columns: 1fr; 
    gap: 12px; 
    margin: 16px 0; 
  }
  
  .product-card { padding: 10px; }
  .product-title { font-size: 14px; min-height: auto; margin: 8px 0; }
  .price { font-size: 15px; }
  
  /* Single Product Mobile */
  .novoshop-product-single { 
    flex-direction: column; 
    gap: 20px; 
    padding: 16px 0; 
  }
  .product-left, .product-right { width: 100%; }
  .product-price { font-size: 18px; }
  
  /* Shop Layout Mobile */
  .shop-container { 
    flex-direction: column; 
    gap: 16px; 
    padding: 16px 0; 
  }
  .shop-filters { 
    width: 100%; 
    margin-bottom: 0; 
    padding: 12px; 
  }
  .shop-products { width: 100%; }
  
  /* Buttons Mobile */
  .button { padding: 8px 12px; font-size: 13px; }
  
  /* Gallery Mobile */
  .product-gallery .gallery-thumbs { 
    gap: 6px; 
    margin-top: 8px; 
  }
  .product-gallery .gallery-thumbs img { 
    width: 50px; 
    height: 50px; 
  }
  
  /* Navigation Mobile */
  .main-navigation { display: none; }
  .mobile-menu-toggle { display: block; }
}

/* Large Mobile (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
  body { font-size: 15px; }
  .container { padding: 0 16px; }
  
  .products-grid { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 16px; 
  }
  .product-card { padding: 12px; }
  
  .novoshop-product-single { 
    flex-direction: column; 
    gap: 24px; 
  }
  .product-left, .product-right { width: 100%; }
  
  .shop-container { 
    flex-direction: column; 
    gap: 20px; 
  }
  .shop-filters { width: 100%; }
  
  .main-navigation { display: none; }
  .mobile-menu-toggle { display: block; }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  body { font-size: 16px; }
  .container { padding: 0 20px; }
  
  .products-grid { 
    grid-template-columns: repeat(3, 1fr); 
    gap: 18px; 
  }
  
  .novoshop-product-single { 
    flex-direction: row; 
    gap: 28px; 
  }
  .product-left { width: 45%; }
  .product-right { width: 55%; }
  
  .shop-container { 
    flex-direction: row; 
    gap: 24px; 
  }
  .shop-filters { 
    width: 250px; 
    flex: 0 0 250px; 
  }
  .shop-products { flex: 1; }
  
  .main-navigation { display: block; }
  .mobile-menu-toggle { display: none; }
}

/* Desktop (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  .container { padding: 0 24px; }
  
  .products-grid { 
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; 
  }
  
  .novoshop-product-single { gap: 32px; }
  .product-left { width: 48%; }
  .product-right { width: 52%; }
  
  .shop-filters { 
    width: 280px; 
    flex: 0 0 280px; 
  }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  .container { padding: 0 32px; }
  
  .products-grid { 
    grid-template-columns: repeat(5, 1fr); 
    gap: 24px; 
  }
  
  .novoshop-product-single { gap: 40px; }
  
  .shop-filters { 
    width: 320px; 
    flex: 0 0 320px; 
  }
}

/* ============================================
   MOBILE-SPECIFIC ENHANCEMENTS
   ============================================ */

/* Touch-friendly elements */
@media (max-width: 767px) {
  /* Larger touch targets */
  .button, .user-link, .cart-link, .action-icon a {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Improved spacing */
  .product-card { margin-bottom: 16px; }
  
  /* Better form elements */
  .search-field, .search-category {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Swipe gestures for mobile */
  .product-gallery { touch-action: pan-x; }
  
  /* Mobile-specific animations */
  .novoshop-menu {
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  
  .novoshop-menu.mobile-menu-open {
    transform: translateX(0);
  }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */
@media (max-width: 767px) and (orientation: landscape) {
  .header-content {
    flex-direction: row;
    gap: 15px;
  }
  
  .header-search { order: 2; flex: 1; }
  .header-actions { order: 3; }
  
  .novoshop-menu {
    width: 100%;
    height: auto;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    transform: translateY(100%);
  }
  
  .novoshop-menu.mobile-menu-open {
    transform: translateY(0);
  }
}

/* ============================================
   HIGH DPI DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .product-card img, .header-logo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .site-header, .mobile-menu-toggle, .header-actions-icons, .shop-filters {
    display: none !important;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
  
  .product-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
  }
}

/* ============================================
   UTILITY CLASSES FOR RESPONSIVE DESIGN
   ============================================ */

/* Hide on mobile */
.hide-mobile { display: block; }
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}

/* Show only on mobile */
.show-mobile { display: none; }
@media (max-width: 767px) {
  .show-mobile { display: block !important; }
}

/* Hide on tablet and below */
.hide-tablet { display: block; }
@media (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}

/* Show only on desktop */
.show-desktop { display: none; }
@media (min-width: 1024px) {
  .show-desktop { display: block !important; }
}

/* Responsive text alignment */
.text-center-mobile { text-align: left; }
@media (max-width: 767px) {
  .text-center-mobile { text-align: center; }
}

/* Responsive spacing */
.padding-mobile { padding: 20px; }
@media (max-width: 767px) {
  .padding-mobile { padding: 12px; }
}

/* Responsive grid */
.grid-mobile-1 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
@media (max-width: 767px) {
  .grid-mobile-1 { grid-template-columns: 1fr; }
}

/* RTL small fix: float directions */
html[dir="rtl"] .header-right{ float:right; }
