/* Base */
:root{
  --primary:#4a6cf7;
  --primary-dark:#3a56d4;
  --secondary:#6c757d;
  --success:#28a745;
  --danger:#dc3545;
  --light:#f8f9fa;
  --dark:#343a40;
  --gray:#6c757d;
  --light-gray:#e9ecef;
  --radius:10px;
  --shadow:0 4px 12px rgba(0,0,0,.08);
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:'Vazir','Segoe UI',Tahoma,sans-serif;
  background:#f9fafb;
  color:#333;
  line-height:1.6;
  overflow-x:hidden;
}

/* Prevent images from causing overflow on small screens */
img{max-width:100%;height:auto;}

a{color:inherit;text-decoration:none;}

.container{max-width:1200px;margin:0 auto;padding:0 15px;}
.page-container{max-width:1200px;margin:0 auto;padding:20px 15px;}

/* Buttons */
.btn{
  padding:10px 18px;
  border-radius:10px;
  border:0;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  transition:all .2s ease;
  font-weight:600;
}
.btn-small{padding:8px 14px;font-size:.9rem;border-radius:9px;}
.btn-primary{background:var(--primary);color:#fff;}
.btn-primary:hover{background:var(--primary-dark);transform:translateY(-1px);}
.btn-secondary{background:#fff;color:var(--secondary);border:1px solid var(--light-gray);}
.btn-secondary:hover{border-color:#cfd4da;transform:translateY(-1px);}

.input, input[type="text"], input[type="number"], select, textarea{
  padding:10px 12px;
  border:1px solid var(--light-gray);
  border-radius:10px;
  font-family:inherit;
}
input:focus, select:focus, textarea:focus{outline:none;border-color:var(--primary);}

/* Header */
.main-header{
  position:sticky;
  top:0;
  z-index:50;
  background:#fff;
  border-bottom:1px solid var(--light-gray);
  box-shadow:0 2px 8px rgba(0,0,0,.04);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
}
.header-left, .header-right{display:flex;align-items:center;gap:10px;}
.header-center{display:flex;flex-direction:column;align-items:center;gap:2px;}
.site-title{font-weight:900;font-size:1.1rem;}
.welcome{font-size:.85rem;color:var(--gray);}

.search-form{display:none;}
.search-form input{width:220px;}

.icon-link{position:relative;display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:12px;border:1px solid var(--light-gray);background:#fff;}
.icon-link:hover{border-color:#cfd4da;}
.icon-btn{cursor:pointer;padding:0;border:0;background:transparent;appearance:none;-webkit-appearance:none;}
.icon-btn.icon-link{border:1px solid var(--light-gray);background:#fff;}
.badge{
  position:absolute;
  top:-7px;
  left:-7px;
  background:var(--danger);
  color:#fff;
  min-width:18px;
  height:18px;
  border-radius:999px;
  font-size:.75rem;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 5px;
}

.hamburger{
  width:44px;height:38px;
  border:1px solid var(--light-gray);
  background:#fff;
  border-radius:12px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:5px;
  cursor:pointer;
}
.hamburger span{display:block;width:18px;height:2px;background:#333;border-radius:2px;}

/* Side menu */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
  z-index:40;
  /* Keep overlay behind sticky header (z-index:50) so header dropdowns remain clickable */
}
.overlay.show{opacity:1;pointer-events:auto;}

.side-menu{
  position:fixed;
  top:0;
  right:-320px;
  width:300px;
  height:100vh;
  background:#fff;
  box-shadow:-10px 0 30px rgba(0,0,0,.12);
  z-index:70;
  transition:right .25s ease;
  padding:16px;
}
.side-menu.open{right:0;}
.close-menu{
  border:1px solid var(--light-gray);
  background:#fff;
  border-radius:12px;
  width:42px;
  height:42px;
  cursor:pointer;
  font-size:1.6rem;
  line-height:1;
}
.side-menu ul{list-style:none;margin:14px 0 0;padding:0;display:flex;flex-direction:column;gap:8px;}
.side-menu a{display:block;padding:10px 12px;border-radius:12px;border:1px solid var(--light-gray);}
.side-menu a:hover{border-color:#cfd4da;background:#fafbff;}

/* Side menu submenu */
.side-menu .submenu-btn{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--light-gray);
  background:#fff;
  cursor:pointer;
  font-family:inherit;
  font-weight:700;
}
.side-menu .submenu-btn:hover{border-color:#cfd4da;background:#fafbff;}
.side-menu .submenu{
  list-style:none;
  margin:6px 0 0;
  padding:0;
  display:none;
  flex-direction:column;
  gap:6px;
}
.side-menu .submenu.open{display:flex;}
.side-menu .submenu a{
  background:#fafafa;
  margin-right:10px;
}
.side-menu .submenu-empty{
  display:block;
  padding:10px 12px;
  border-radius:12px;
  border:1px dashed var(--light-gray);
  color:var(--gray);
  margin-right:10px;
}

/* User dropdown */
.user-dropdown{position:relative;}
.user-trigger{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--light-gray);
  background:#fff;
  border-radius:12px;
  padding:6px 10px;
  cursor:pointer;
  font-family:inherit;
  font-weight:800;
}
.user-trigger:hover{border-color:#cfd4da;}
.user-avatar{
  width:30px;
  height:30px;
  border-radius:12px;
  background:#f3f4f6;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
}
.user-name{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.user-dropdown-menu{
  position:absolute;
  top:calc(100% + 8px);
  left:0;
  right:auto;
  width:200px;
  max-width:calc(100vw - 16px);
  background:#fff;
  border:1px solid var(--light-gray);
  box-shadow:var(--shadow);
  border-radius:14px;
  padding:8px;
  display:none;
  z-index:2000;
}
.user-dropdown-menu.open{display:block;}
.user-dropdown-menu a{
  display:block;
  padding:10px 12px;
  border-radius:12px;
}
.user-dropdown-menu a:hover{background:#f5f7ff;}

/* Mobile: render the user menu as fixed so it never clips/overflows and never shifts layout */
@media (max-width: 768px){
  .user-dropdown-menu{
    position:fixed;
    top:56px; /* will be overridden by JS to align under the trigger */
    left:8px;
    right:auto;
  }
}

/* Notifications dropdown (bell) */
.notif-dropdown{position:relative;}
.notif-menu{
  left:auto;
  right:0;
  width:280px;
  max-width:calc(100vw - 24px);
}
.notif-menu .notif-empty{
  padding:14px 12px;
  text-align:center;
  color:#777;
}

/* Product cards (used in favorites/products pages) */
.product-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:18px;
}
.product-card{
  background:#fff;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.product-image-wrapper{display:block;height:190px;overflow:hidden;position:relative;}
.product-image-wrapper img{width:100%;height:100%;object-fit:cover;display:block;}
.product-body{padding:14px;}
.product-title{margin:0 0 8px;font-size:1.05rem;}
.product-price{margin:0 0 8px;color:var(--primary);font-weight:800;}
.inline-form{display:inline;}

.product-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px;}
.product-footer .btn{flex:1;min-width:0;position:relative;z-index:1;}
.product-footer .btn.btn-nowrap{overflow:hidden;text-overflow:ellipsis;}
.product-footer .fav-btn{position:relative;z-index:2;}

/* Stage 3: heart (favorites) next to "مشاهده و خرید" */
.btn-nowrap{white-space:nowrap;}
/*
  NOTE: On some mobile browsers, default button :focus/:active styles can override base styles
  and show a grey square/background around the heart. We hard-reset those states here.
*/
button.fav-btn,
a.fav-btn{
  -webkit-appearance:none;
  appearance:none;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  padding:0 !important;
  margin:0;
  width:38px;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:1.25rem;
  line-height:1;
  cursor:pointer;
  color:#6c757d;
  text-decoration:none;
  outline:none !important;
  -webkit-tap-highlight-color:transparent;
}
button.fav-btn:focus,
button.fav-btn:active,
button.fav-btn:focus-visible,
a.fav-btn:focus,
a.fav-btn:active,
a.fav-btn:focus-visible{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  outline:none !important;
}
button.fav-btn::-moz-focus-inner{border:0;padding:0;}
.fav-btn i{pointer-events:none;}
.fav-btn:hover{opacity:0.9;}
.fav-btn.is-fav{color:var(--danger,#dc3545);}
.btn-icon{width:44px;min-width:44px;padding:8px;flex:0 0 auto;}

/* Address book: default star selector */
.address-title{display:flex;align-items:center;gap:8px;}
.addr-default-form{display:inline;}
button.addr-star-btn{
  -webkit-appearance:none;
  appearance:none;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  padding:0 !important;
  margin:0;
  width:34px;
  height:34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:1.1rem;
  line-height:1;
  cursor:pointer;
  color:#9ca3af;
  outline:none !important;
  -webkit-tap-highlight-color:transparent;
}
button.addr-star-btn:focus,
button.addr-star-btn:active,
button.addr-star-btn:focus-visible{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  outline:none !important;
}
button.addr-star-btn i{pointer-events:none;}
button.addr-star-btn:hover{opacity:0.9;}
button.addr-star-btn.is-default{color:#f59e0b;}
button.addr-star-btn:disabled{opacity:1;cursor:default;}

.badge{display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:999px;font-size:.85rem;font-weight:800;}
.badge-out{background:#fee2e2;color:#991b1b;border:1px solid #fecaca;position:absolute;top:10px;right:10px;}

/* Simple toast (used for small success messages) */
.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%) translateY(10px);
  background:#111827;
  color:#fff;
  padding:12px 14px;
  border-radius:14px;
  box-shadow:var(--shadow);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
  z-index:99999;
  max-width:calc(100vw - 32px);
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}

/* Cart */
.cart-section h2{margin:12px 0 18px;}
.cart-table{width:100%;border-collapse:collapse;background:#fff;border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow);}
.cart-table th,.cart-table td{padding:12px;border-bottom:1px solid var(--light-gray);text-align:right;vertical-align:middle;}
.cart-table th{background:#fafafa;font-weight:800;}
.cart-thumb{width:86px;height:86px;object-fit:cover;border-radius:12px;border:1px solid var(--light-gray);margin-left:10px;}
.cart-product-cell{display:flex;align-items:center;gap:10px;}
.cart-summary{margin-top:16px;display:flex;flex-direction:column;gap:10px;align-items:flex-start;}
.cart-summary-actions{display:flex;flex-wrap:wrap;gap:10px;}
.cart-qty{width:96px;}

/* Footer */
.main-footer{margin-top:40px;background:#111827;color:#e5e7eb;padding:32px 0 0;}
.footer-grid{display:grid;gap:22px;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));}
.footer-col h4{margin:0 0 12px;font-weight:900;color:#fff;font-size:1.02rem;}
.footer-col ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px;}
.footer-col a{color:#e5e7eb;text-decoration:none;opacity:.9;}
.footer-col a:hover{opacity:1;text-decoration:underline;}

.footer-brand-title{font-size:1.2rem;font-weight:1000;color:#fff;}
.footer-brand-sub{margin-top:8px;color:#9ca3af;line-height:1.8;}

.footer-social{margin-top:14px;display:flex;gap:10px;flex-wrap:wrap;}
.footer-social a{width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.15);border-radius:14px;}
.footer-social a:hover{border-color:rgba(255,255,255,.35);text-decoration:none;}

.footer-contact li{display:flex;align-items:flex-start;gap:10px;line-height:1.6;}
.footer-contact i{margin-top:3px;color:#9ca3af;min-width:16px;}
.footer-contact .addr span{color:#e5e7eb;opacity:.9;}

.footer-bottom{margin-top:26px;border-top:1px solid rgba(255,255,255,.1);padding:14px 0;}
.footer-bottom-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;color:#9ca3af;font-size:.95rem;}
.footer-note{opacity:.9;}

/* Responsive */
@media (min-width: 900px){
  .search-form{display:block;}
}


/* --- Step 5 additions --- */
.card{
  background:#fff;
  border:1px solid var(--light-gray);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  margin:12px 0;
}

/* Profile pages */
.profile-block h4{margin:0 0 12px 0;font-size:1.05rem;}
.profile-info{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px;}
.profile-info-item{background:#f8fafc;border:1px solid var(--light-gray);border-radius:14px;padding:12px;}
.profile-info-label{font-size:.9rem;color:#6b7280;margin-bottom:4px;}
.profile-info-value{font-weight:800;color:#111827;word-break:break-word;}
.profile-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.profile-form-grid .form-group{margin:0;}
@media (max-width:600px){.profile-form-grid{grid-template-columns:1fr;}}
.profile-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px;}
@media (max-width:600px){.profile-info{grid-template-columns:1fr;}}

.muted{color:#6c757d;}
.hr{border:0;border-top:1px solid var(--light-gray);margin:12px 0;}

.alert{
  padding:12px 14px;
  border-radius:12px;
  margin:12px 0;
  border:1px solid var(--light-gray);
  background:#fff;
}
.alert-danger{border-color:#f5c2c7;background:#fff5f5;}
.alert-success{border-color:#badbcc;background:#f0fff6;}
.list{margin:0;padding-right:18px;}

.form-wrap{
  max-width:520px;
  margin:0 auto;
  background:#fff;
  border:1px solid var(--light-gray);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px;
}
.form label{display:block;margin:10px 0 6px;font-weight:600;}
.form input,.form textarea,.form select{width:100%;}
.form-help{margin-top:12px;}
.link{color:var(--primary);}

.page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.filters-form{
  display:flex !important;
  gap:12px;
  /* One row + horizontal scroll (prevents overflow/collisions) */
  flex-wrap:nowrap !important;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  align-items:flex-end;
  /* Ensure the scroll container itself never grows beyond the viewport
     (prevents clipping when body has overflow-x hidden). */
  max-width:100%;
  width:100%;
  min-width:0;
  scrollbar-gutter:stable;
  scrollbar-width:thin;
  touch-action:pan-x;
  background:#fff;
  border:1px solid var(--light-gray);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:12px;
}
.filter-group{display:flex;flex-direction:column;gap:6px;min-width:180px;flex:0 0 auto;}
.filter-group label{font-weight:600;font-size:.92rem;color:#444;}
.filter-actions{display:flex;gap:10px;align-items:center;flex:0 0 auto;}

/* Prevent custom selects from forcing overflow inside filter rows */
.filter-group input,
.filter-group select,
.filter-group .cselect{width:100%;min-width:0;}

.product-card .actions{
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:10px;
}
.product-card .actions form{margin:0;}

.category-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:12px;
  margin-top:14px;
}
.category-card{
  background:#fff;
  border:1px solid var(--light-gray);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  transition:transform .15s ease;
}
.category-card:hover{transform:translateY(-2px);}
.category-title{font-weight:800;}
.category-count{color:#6c757d;margin-top:4px;font-size:.92rem;}

.grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
@media (max-width: 860px){
  .grid-2{grid-template-columns:1fr;}
}

.pagination{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin:18px 0 6px;
}
.page-link{
  background:#fff;
  border:1px solid var(--light-gray);
  border-radius:12px;
  padding:8px 12px;
}
.page-info{color:#6c757d;}

.checkout-items{display:flex;flex-direction:column;gap:10px;margin-top:10px;}
.checkout-item{display:flex;gap:10px;align-items:center;border:1px solid var(--light-gray);border-radius:12px;padding:10px;}
.checkout-item img{width:62px;height:62px;object-fit:cover;border-radius:10px;border:1px solid var(--light-gray);}
.checkout-item-title{font-weight:700;}
.checkout-item-meta{color:#6c757d;font-size:.92rem;margin-top:2px;}
.checkout-item-price{margin-top:6px;font-weight:800;}
.checkout-total{display:flex;align-items:center;justify-content:space-between;margin-top:12px;padding-top:12px;border-top:1px solid var(--light-gray);font-size:1.05rem;}

.order-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.order-head h3{margin:0;font-size:1.1rem;}

/* Order details: cleaner, easier-to-scan layout */
.order-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:12px 0;}
.order-meta > div{background:#f8fafc;border:1px solid var(--light-gray);border-radius:14px;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;gap:12px;}
.order-meta > div b{font-weight:800;}
.order-meta > div .muted{white-space:nowrap;}

.order-address{margin:12px 0;border:1px dashed var(--light-gray);border-radius:14px;padding:12px;background:#fcfdff;line-height:1.9;}
.order-items{display:flex;flex-direction:column;gap:10px;margin-top:10px;}
.order-item{border:1px solid var(--light-gray);border-radius:14px;padding:12px;background:#fff;display:flex;flex-direction:column;gap:6px;}
.order-item-title{font-weight:800;}
.order-item .muted{font-size:.92rem;}
.order-item-sub{margin-top:6px;font-weight:800;text-align:left;}

.orders-list{display:flex;flex-direction:column;gap:10px;margin-top:10px;}
.order-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:1px solid var(--light-gray);
  border-radius:14px;
  padding:12px;
  background:#fff;
  transition:transform .15s ease;
}
.order-row:hover{transform:translateY(-2px);}
.order-row-main{display:flex;flex-direction:column;gap:4px;min-width:0;}
.order-row-title{font-weight:800;}
.order-row-amount{font-weight:800;white-space:nowrap;}
.order-row i{color:#94a3b8;}

@media (max-width: 700px){
  .order-meta{grid-template-columns:1fr;}
  .order-row{flex-wrap:wrap;}
  .order-row-amount{width:100%;text-align:left;}
}

/* Stage 4: filters + ratings + reviews */
.filter-group .check{display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;}
.filter-group .check input{margin:0;}

.rating{display:flex;align-items:center;gap:8px;margin-top:6px;font-size:.95rem;}
.rating .stars{display:inline-flex;gap:2px;}

.reviews{margin-top:18px;}
.review-list{display:flex;flex-direction:column;gap:10px;margin-top:10px;}
.review-item{border:1px solid var(--light-gray);border-radius:12px;padding:12px;background:#fff;}
.review-head{display:flex;align-items:center;justify-content:space-between;gap:10px;}
.review-author{font-weight:800;}
.review-date{color:#6c757d;font-size:.9rem;}
.review-body{margin-top:8px;line-height:1.9;}


/* Stage 3: Product details layout */
.breadcrumb{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:#6b7280;font-size:.92rem;margin:4px 0 14px;}
.breadcrumb .sep{color:#9ca3af;}
.breadcrumb a{color:#374151;}
.breadcrumb a:hover{color:var(--primary);} 
.breadcrumb .current{color:#111827;font-weight:700;}

.pd-card{
  background:#fff;
  border:1px solid var(--light-gray);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  display:grid;
  grid-template-columns:420px 1fr;
  gap:18px;
}
@media (max-width: 980px){
  .pd-card{grid-template-columns:1fr;}
}

.pd-gallery{display:flex;flex-direction:column;gap:10px;}
.pd-main-image{position:relative;border-radius:16px;overflow:hidden;border:1px solid var(--light-gray);background:#fff;}
.pd-main-image img{width:100%;height:420px;object-fit:cover;display:block;}
@media (max-width: 980px){
  .pd-main-image img{height:360px;}
}

.pd-nav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:42px;
  height:42px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.7);
  background:rgba(17,24,39,.35);
  color:#fff;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.2rem;
  backdrop-filter: blur(6px);
}
.pd-nav.prev{right:10px;}
.pd-nav.next{left:10px;}

.pd-thumbs{display:flex;gap:10px;overflow:auto;padding-bottom:4px;}
.pd-thumb{border:1px solid var(--light-gray);background:#fff;border-radius:14px;padding:0;cursor:pointer;flex:0 0 auto;}
.pd-thumb img{width:76px;height:76px;object-fit:cover;border-radius:14px;display:block;}
.pd-thumb.active{border-color:var(--primary);box-shadow:0 0 0 3px rgba(74,108,247,.15);} 

.pd-info{display:flex;flex-direction:column;gap:12px;}
.pd-title{margin:0;font-size:1.35rem;line-height:1.8;font-weight:900;color:#111827;}
.pd-meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
.pd-badge{background:#f3f4f6;border:1px solid #e5e7eb;color:#374151;padding:6px 10px;border-radius:999px;font-size:.9rem;}
.pd-rating .stars{color:#f59e0b;}

.pd-price-row{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:10px;padding:12px;border:1px solid var(--light-gray);border-radius:16px;background:#fafbff;}
.pd-price{font-size:1.6rem;font-weight:900;color:var(--primary);}
.pd-stock{display:flex;align-items:center;gap:8px;}
.pd-stock .state{font-weight:800;}

.pd-variant-box{border:1px solid var(--light-gray);border-radius:16px;padding:12px;background:#fff;}
.pd-variant-title{font-weight:900;margin-bottom:10px;color:#111827;}
.pd-variant-selects{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
@media (max-width: 560px){
  .pd-variant-selects{grid-template-columns:1fr;}
}
.pd-field label{display:block;margin-bottom:6px;font-weight:700;color:#374151;}
.pd-select{width:100%;}

.pd-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.pd-qty{display:inline-flex;align-items:center;gap:8px;padding:6px 8px;border:1px solid var(--light-gray);border-radius:16px;background:#fff;}
.pd-qty-btn{width:38px;height:38px;border-radius:12px;border:1px solid #e5e7eb;background:#f9fafb;cursor:pointer;font-weight:900;line-height:1;display:inline-flex;align-items:center;justify-content:center;}
.pd-qty-btn:hover{background:#f3f4f6;}
.pd-qty-btn:disabled{opacity:.55;cursor:not-allowed;}
.pd-qty-input{width:64px;min-height:38px;border:0;background:transparent;text-align:center;font-weight:900;color:#111827;}
.pd-qty-input:focus{outline:none;}
.pd-buy{padding:12px 18px;border-radius:16px;min-height:44px;}
.pd-fav{width:46px;height:46px;border-radius:16px;border:1px solid var(--light-gray);background:#fff;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:1.2rem;}
.pd-fav:hover{border-color:#cfd4da;background:#fafafa;}

.pd-variants-stock{border:1px solid var(--light-gray);border-radius:16px;padding:12px;background:#fff;}
.pd-variants-title{font-weight:900;margin-bottom:10px;color:#111827;}
.pd-variants-scroll{overflow:auto;}
.pd-variants-table{width:100%;border-collapse:separate;border-spacing:0;min-width:320px;}
.pd-variants-table th,.pd-variants-table td{padding:10px;border-bottom:1px solid #eef0f3;font-size:.95rem;text-align:right;white-space:nowrap;}
.pd-variants-table thead th{background:#fafbff;font-weight:900;}
.pd-variants-table tbody tr.is-out{opacity:.65;}
.pd-variants-table tbody tr.is-selected{background:rgba(74,108,247,.08);box-shadow:inset 0 0 0 2px rgba(74,108,247,.35);}

.pd-desc, .pd-specs{border:1px solid var(--light-gray);border-radius:16px;padding:12px;background:#fff;}
.pd-desc h3, .pd-specs h3{margin:0 0 8px;font-size:1.05rem;font-weight:900;}
.pd-desc-body{color:#374151;line-height:2;}

.pd-spec-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;}
.pd-spec-list li{display:flex;align-items:center;justify-content:space-between;gap:10px;background:#f9fafb;border:1px solid #e5e7eb;border-radius:14px;padding:10px;}
.pd-spec-list li span:first-child{color:#6b7280;font-weight:700;}
.pd-spec-list li span:last-child{color:#111827;font-weight:800;}

/* --- Step 6 additions: Auth/Profile layout (two-column card) --- */
.auth-shell{
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 14px;
}

.auth-card{
  direction: ltr; /* keep columns physical: left form, right blue panel */
  display: flex;
  /* Desktop: form on the left, blue panel on the right */
  flex-direction: row-reverse;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--light-gray);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-left{
  direction: rtl;
  flex: 1;
  padding: 22px 22px;
}

.auth-right{
  direction: rtl;
  width: 360px;
  background: #1f6feb;
  color: #fff;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auth-right .auth-badge{
  width: 92px;
  height: 92px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.25);
  margin-bottom: 14px;
}

.auth-right .auth-badge i{font-size: 36px;}
.auth-right h3{margin: 0 0 8px;font-size: 22px;}
.auth-right p{margin: 0;opacity: .92;line-height: 1.8;}

.auth-title{margin: 0 0 6px;font-size: 22px;}
.auth-sub{margin: 0 0 14px;color: #6c757d;}

.auth-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.auth-check{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: .95rem;
  color: #4b5563;
}

.auth-check input{width: auto !important;}

.input-group{
  position: relative;
}

.toggle-pass{
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  padding: 6px;
}

.input-group input{
  padding-left: 44px;
}

.auth-actions{margin-top: 14px;}
.auth-actions .btn{width: 100%;padding: 12px 14px;border-radius: 14px;}

.auth-foot{
  margin-top: 14px;
  color: #6b7280;
  font-size: .95rem;
}

.auth-foot a{color: var(--primary);font-weight: 700;}

@media (max-width: 900px){
  /* Mobile: single stacked card, blue panel on top */
  .auth-card{flex-direction: column !important; direction: rtl;}
  .auth-right{width: 100%; min-height: unset; padding: 22px 16px;}
  .auth-left{padding: 20px 16px;}
}

/* Profile inner blocks */
.profile-block{border-top: 1px solid var(--light-gray);padding-top: 14px;margin-top: 14px;}
.profile-block:first-of-type{border-top:0;padding-top:0;margin-top:0;}
.profile-block h4{margin: 0 0 10px;font-size: 18px;}


/* =========================================================
   Stage 10: Full responsive polish (mobile/tablet/desktop)
   ========================================================= */

/* Header: prevent overflow on small screens */
@media (max-width: 768px){
  .main-header{gap:8px;padding:10px 10px;}
  .header-center{display:none;}
  .search-form{display:none !important;}
  .site-title{font-size:1.05rem;}
  .icon-link{width:36px;height:36px;border-radius:12px;}
  .hamburger{width:44px;height:36px;}
}

@media (max-width: 420px){
  .main-header{padding:10px 8px;}
  .user-name{max-width:84px;}
  .user-trigger{padding:6px 8px;}
}

/* Side menu width on mobile */
@media (max-width: 520px){
  .side-menu{width:88vw;max-width:320px;}
}

/* Product grids */
@media (max-width: 992px){
  .page-container{padding:16px 12px;}
}

@media (max-width: 768px){
  .product-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
  .product-image-wrapper{height:165px;}
  .product-body{padding:12px;}
  .product-title{font-size:1rem;}
}

/* Keep 2 columns in mobile for products list (per requirement)
   Reduce card elements for very small screens to avoid overflow. */
@media (max-width: 420px){
  .product-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
  .product-image-wrapper{height:150px;}
  .product-title{font-size:.95rem;}
  .product-price{font-size:1rem;}
  .btn-small{padding:8px 10px;}
  .btn-icon{width:40px;min-width:40px;}
}

/* Filters: horizontal one-row scroll on mobile (prevents overflow) */
@media (max-width: 560px){
  .filters-form{
    gap:10px;
    padding:10px;
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:visible;
    -webkit-overflow-scrolling:touch;
    /* Align the checkbox filter ("فقط موجود") with selects in the same row */
    align-items:flex-end;
    max-width:100%;
    width:100%;
  }
  .filters-form::-webkit-scrollbar{height:6px;}
  .filter-group{
    min-width:160px;
    flex:0 0 auto;
  }
  .filter-group input,
  .filter-group select{max-width:100%;}
  .filter-actions{
    flex:0 0 auto;
    width:auto;
    justify-content:flex-start;
  }
  .filter-actions .btn{flex:0 0 auto;}
}

/* Product details: reduce image height on very small screens */
@media (max-width: 560px){
  .pd-main-image img{height:320px;}
  .pd-title{font-size:1.2rem;}
  .pd-price{font-size:1.35rem;}
}

@media (max-width: 400px){
  .pd-main-image img{height:280px;}
  .pd-thumb img{width:64px;height:64px;}
}

/* Cart: make table stack into cards on mobile */
@media (max-width: 720px){
  .cart-table,
  .cart-table thead,
  .cart-table tbody,
  .cart-table th,
  .cart-table td,
  .cart-table tr{display:block;}

  .cart-table thead{display:none;}
  .cart-table{background:transparent;box-shadow:none;border-radius:0;}

  .cart-table tr{
    background:#fff;
    border:1px solid var(--light-gray);
    border-radius:16px;
    box-shadow:var(--shadow);
    padding:12px;
    margin-bottom:12px;
  }

  .cart-table td{
    border:0;
    padding:10px 0;
    display:grid;
    grid-template-columns:92px 1fr;
    align-items:center;
    column-gap:12px;
    row-gap:8px;
  }

  .cart-table tr td{border-bottom:1px dashed var(--light-gray);}
  .cart-table tr td:last-child{border-bottom:0;padding-bottom:0;}

  .cart-table td::before{
    content:attr(data-label);
    font-weight:900;
    color:#6b7280;
    line-height:1.3;
    align-self:start;
  }

  .cart-table td.cart-product-cell{
    align-items:start;
    grid-template-columns:92px 1fr;
  }
  .cart-table td.cart-product-cell::before{content:'محصول';}

  .cart-table td.cart-product-cell span{
    font-weight:900;
    line-height:1.5;
    word-break:break-word;
  }

  .cart-table td[data-label="تعداد"]{align-items:start;}
  .cart-table td[data-label="تعداد"] .cart-qty{width:100%;max-width:140px;}
  .cart-table td[data-label="حذف"] .btn{width:100%;justify-content:center;}

  .cart-thumb{width:74px;height:74px;margin-left:0;}
  .cart-qty{width:96px;}
  .cart-summary{align-items:stretch;}
  .cart-summary-actions{width:100%;}
  .cart-summary-actions .btn{flex:1;}
}

/* Footer: stack columns on small screens */
@media (max-width: 560px){
  .footer-grid{grid-template-columns:1fr;}
}




/* Utilities */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}


/* ===== Stage 11: UI/UX polish (dropdowns, menus, selects) ===== */

/* Native form controls (baseline) */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea{
  border:1px solid var(--light-gray);
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
  font-family:inherit;
  outline:none;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, select:focus, textarea:focus{
  border-color:rgba(74,108,247,.55);
  box-shadow:0 0 0 4px rgba(74,108,247,.12);
}

/* Custom Select (fully styled dropdown) */
.cselect{position:relative;min-width:180px;}
.cselect-native{display:none;}
.cselect-trigger{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:1px solid var(--light-gray);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  font-family:inherit;
  font-weight:700;
}
.cselect-trigger:hover{border-color:#cfd4da;}
.cselect-trigger .cselect-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.cselect-trigger .cselect-arrow{font-size:.9rem;color:#667085;transition:transform .15s ease;}
.cselect.open .cselect-trigger .cselect-arrow{transform:rotate(180deg);}

.cselect-menu{
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  left:0;
  background:#fff;
  border:1px solid var(--light-gray);
  border-radius:14px;
  box-shadow:var(--shadow);
  padding:6px;
  display:none;
  z-index:120;
  max-height:260px;
  overflow:auto;
}
.cselect.open .cselect-menu{display:block;animation:cselectIn .12s ease;}
@keyframes cselectIn{
  from{opacity:0;transform:translateY(-4px);}
  to{opacity:1;transform:translateY(0);}
}
.cselect-option{
  width:100%;
  text-align:right;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 10px;
  border-radius:12px;
  border:0;
  background:transparent;
  cursor:pointer;
  font-family:inherit;
  font-weight:600;
}
.cselect-option:hover{background:#f5f7ff;}
.cselect-option.selected{background:#eef2ff;}
.cselect-option .tick{opacity:0;color:var(--primary);font-weight:900;}
.cselect-option.selected .tick{opacity:1;}
.cselect-option[disabled]{opacity:.55;cursor:not-allowed;}

/* Filters: make checkbox look nicer */
.filter-group .check{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--light-gray);
  border-radius:12px;
  background:#fff;
}
.filter-group .check input{width:18px;height:18px;}

/* Dropdown menus (user menu) smoother */
.user-dropdown-menu{
  transform-origin:top right;
}
.user-dropdown-menu.open{
  display:block;
  animation:dropdownIn .12s ease;
}
@keyframes dropdownIn{
  from{opacity:0;transform:translateY(-6px) scale(.98);}
  to{opacity:1;transform:translateY(0) scale(1);}
}

/* Side menu submenu: better indentation and separators */
.side-menu .submenu a{
  border:1px solid var(--light-gray);
  margin-right:10px;
  padding:9px 10px;
}
.side-menu .submenu a:hover{background:#f5f7ff;border-color:#cfd4da;}

/* Active filters chips (if present) */
.active-filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:10px 0 0;
}
.filter-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--light-gray);
  background:#fff;
  border-radius:999px;
  padding:6px 10px;
  font-size:.9rem;
}
.filter-chip a{color:var(--primary);font-weight:800;}

/* Notifications page */
.notifications-card{padding:14px;}
.notifications-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px;}
.notif-item{border:1px solid var(--light-gray);border-radius:16px;overflow:hidden;background:#fff;}
.notif-link{display:flex;gap:10px;align-items:flex-start;padding:12px 12px;color:inherit;text-decoration:none;}
.notif-link:hover{background:#f7f8ff;}
.notif-title{font-weight:900;margin:0 0 4px;font-size:1rem;}
.notif-text{margin:0;color:#555;font-size:.95rem;line-height:1.7;}
.notif-time{margin-top:8px;color:#888;font-size:.85rem;}
.empty-state{padding:40px 12px;text-align:center;color:#666;font-weight:800;}

/* Dark mode support (if enabled by body.dark) */
body.dark .notif-item{background:#111827;border-color:#1f2937;}
body.dark .notif-link:hover{background:#0b1020;}
body.dark .notif-text{color:#d1d5db;}
body.dark .notif-time{color:#9ca3af;}

\n/* Cart stock */\n.cart-stock span{color:#e11d48;font-weight:700;}\n
