/* Ravix 4.0: Digikala-style desktop header width, mobile category cleanup,
   and a delivery-location modal. Scoped to the header ecosystem only. */
:root{
  --rvx-digi-content:1676px;
  --rvx-location-accent:#ef4056;
  --rvx-location-border:#e6e8ed;
  --rvx-location-surface:#ffffff;
  --rvx-location-muted:#6b7280;
  --rvx-location-shadow:0 24px 80px rgba(16,24,40,.16);
}

/* Desktop width and spacing similar to Digikala on wide screens. */
@media (min-width:1051px){
  .rvx-unified-header .rvx-header-main__inner.rvx-uni-main__inner,
  .rvx-unified-header .rvx-header-nav-row__inner.rvx-uni-nav__inner{
    width:min(calc(100% - 72px),var(--rvx-digi-content))!important;
    max-width:var(--rvx-digi-content)!important;
  }
  .rvx-unified-header .rvx-header-main__inner.rvx-uni-main__inner{gap:18px!important;}
  .rvx-unified-header .rvx-uni-search{max-width:min(605px,43vw)!important;flex:0 1 605px!important;}
  .rvx-unified-header .rvx-uni-search__form{height:44px!important;border-radius:22px!important;background:#f0f0f1!important;}
  .rvx-unified-header .rvx-uni-account{min-height:40px!important;padding:0 14px!important;border-radius:8px!important;}
  .rvx-unified-header .rvx-uni-actions{gap:8px!important;}
  .rvx-unified-header .rvx-uni-cart{margin-right:2px!important;}
  .rvx-unified-header .rvx-uni-nav{border-top-color:#f3f4f6!important;border-bottom-color:#e9eaee!important;}
  .rvx-unified-header .rvx-primary-nav{max-width:52%!important;}
  .rvx-unified-header .rvx-uni-market-links{gap:14px!important;}
  .rvx-unified-header .rvx-uni-market-links a,
  .rvx-unified-header .rvx-menu>li>a,
  .rvx-unified-header .rvx-category-nav__toggle{font-size:11.5px!important;}
}
@media (min-width:1600px){
  .rvx-unified-header .rvx-header-main__inner.rvx-uni-main__inner,
  .rvx-unified-header .rvx-header-nav-row__inner.rvx-uni-nav__inner{
    width:min(calc(100% - 96px),var(--rvx-digi-content))!important;
  }
}
@media (min-width:2000px){
  .rvx-unified-header .rvx-header-main__inner.rvx-uni-main__inner,
  .rvx-unified-header .rvx-header-nav-row__inner.rvx-uni-nav__inner{
    width:min(calc(100% - 120px),var(--rvx-digi-content))!important;
  }
}

/* Selected address chip / trigger. */
.rvx-unified-header [data-rvx-location-trigger],
.rvx-uni-mobile-address [data-rvx-location-trigger]{cursor:pointer;}
.rvx-unified-header .rvx-uni-location{
  max-width:min(360px,24vw)!important;
  gap:6px!important;
  padding:0 10px!important;
  border-radius:999px!important;
  background:#fff5f2!important;
  color:#b45309!important;
}
.rvx-unified-header .rvx-uni-location:hover{background:#ffefe8!important;color:#9a3412!important;}
.rvx-unified-header .rvx-uni-location [data-rvx-location-label]{
  min-width:0!important;
  display:block!important;
  overflow:hidden!important;
  white-space:nowrap!important;
  text-overflow:ellipsis!important;
}
.rvx-uni-mobile-address a[data-rvx-location-trigger]{
  position:relative;
  min-height:34px;
  gap:6px;
}
.rvx-uni-mobile-address a[data-rvx-location-trigger] [data-rvx-location-label]{
  min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
}

/* Delivery location modal. */
body.rvx-location-modal-open{overflow:hidden!important;}
.rvx-location-modal{
  position:fixed;inset:0;z-index:1200;display:grid;place-items:center;
  padding:20px;direction:rtl;
}
.rvx-location-modal[hidden]{display:none!important;}
.rvx-location-modal__backdrop{
  position:absolute;inset:0;background:rgba(15,23,42,.34);backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);opacity:0;transition:opacity .22s ease;
}
.rvx-location-modal__dialog{
  position:relative;z-index:1;width:min(640px,calc(100vw - 32px));
  background:var(--rvx-location-surface);border-radius:18px;border:1px solid #eceef3;
  box-shadow:var(--rvx-location-shadow);padding:18px 18px 16px;
  opacity:0;transform:translateY(12px) scale(.98);
  transition:transform .22s ease,opacity .22s ease;
}
.rvx-location-modal.is-open .rvx-location-modal__backdrop{opacity:1;}
.rvx-location-modal.is-open .rvx-location-modal__dialog{opacity:1;transform:translateY(0) scale(1);}
.rvx-location-modal__close{
  position:absolute;top:14px;left:14px;display:grid;place-items:center;width:34px;height:34px;
  border:0;border-radius:10px;background:#f3f4f6;color:#374151;cursor:pointer;
}
.rvx-location-modal__close:hover{background:#ebeef2;}
.rvx-location-modal__head{padding:4px 4px 14px;text-align:right;}
.rvx-location-modal__head h2{margin:0 0 6px;font-size:20px;line-height:1.4;color:#111827;font-weight:800;}
.rvx-location-modal__head p{margin:0;font-size:13px;line-height:1.8;color:var(--rvx-location-muted);}
.rvx-location-modal__toolbar{display:flex;gap:10px;align-items:center;}
.rvx-location-modal__searchwrap{
  position:relative;display:flex;align-items:center;gap:8px;flex:1 1 auto;
  min-height:48px;padding:0 14px;border:1px solid var(--rvx-location-border);
  border-radius:14px;background:#fff;box-shadow:inset 0 1px 0 rgba(255,255,255,.5);
}
.rvx-location-modal__searchwrap .rvx-icon{flex:0 0 auto;color:#9ca3af;}
.rvx-location-modal__search{
  flex:1 1 auto;min-width:0;border:0;background:transparent;outline:none;
  font:inherit;font-size:14px;color:#111827;padding:0;
}
.rvx-location-modal__search::placeholder{color:#9ca3af;}
.rvx-location-modal__locate{
  flex:0 0 auto;min-height:48px;padding:0 14px;border:1px solid var(--rvx-location-border);
  border-radius:14px;background:#fff;font:inherit;font-size:13px;font-weight:700;color:#374151;cursor:pointer;
}
.rvx-location-modal__locate:hover{background:#f9fafb;}
.rvx-location-modal__suggestions{
  margin-top:10px;max-height:210px;overflow:auto;border:1px solid #edf0f4;border-radius:14px;background:#fff;
}
.rvx-location-modal__suggestions[hidden]{display:none!important;}
.rvx-location-modal__suggestion{
  width:100%;display:flex;flex-direction:column;gap:3px;padding:11px 14px;border:0;border-bottom:1px solid #f1f3f6;
  background:#fff;text-align:right;cursor:pointer;
}
.rvx-location-modal__suggestion:last-child{border-bottom:0;}
.rvx-location-modal__suggestion:hover{background:#fafbfc;}
.rvx-location-modal__suggestion strong{font-size:13px;color:#111827;}
.rvx-location-modal__suggestion span{font-size:11px;color:#6b7280;line-height:1.7;}
.rvx-location-modal__map{
  margin-top:12px;height:320px;border-radius:16px;border:1px solid #e8ebf0;overflow:hidden;background:#f4f6f8;
}
.rvx-location-modal__footer{padding-top:12px;display:grid;gap:12px;}
.rvx-location-modal__selection{
  min-height:48px;padding:12px 14px;border-radius:14px;background:#f8fafc;border:1px solid #edf2f7;
  color:#374151;font-size:13px;line-height:1.8;
}
.rvx-location-modal__save{
  width:100%;min-height:50px;border:0;border-radius:12px;background:var(--rvx-location-accent);
  color:#fff;font:inherit;font-size:15px;font-weight:800;cursor:pointer;
  box-shadow:0 12px 24px rgba(239,64,86,.2);
}
.rvx-location-modal__save:hover{filter:brightness(.98);}
.rvx-location-modal__save:disabled{cursor:not-allowed;box-shadow:none;background:#f1a7b1;color:#fff;}
.rvx-location-modal .leaflet-control-attribution{font-size:9px;}
.rvx-location-modal .leaflet-pane,.rvx-location-modal .leaflet-top,.rvx-location-modal .leaflet-bottom{z-index:1;}

/* Mobile category explorer — remove the top four pills/logo/close, keep only back + search. */
@media (max-width:1050px){
  body.rvx-mobile-category-open > #site-header.rvx-site-header,
  body.rvx-mobile-category-open .rvx-site-header.rvx-unified-header{
    visibility:hidden!important;pointer-events:none!important;
  }
  body .rvx-mobile-category-screen,
  body.admin-bar .rvx-mobile-category-screen{
    transition:opacity .22s ease,transform .28s cubic-bezier(.22,.61,.36,1),visibility .22s ease!important;
    transform:translate3d(18px,0,0)!important;
    opacity:0!important;
  }
  body .rvx-mobile-category-screen.is-open{
    transform:translate3d(0,0,0)!important;
    opacity:1!important;
  }
  body .rvx-mobile-category-screen__quickbar,
  body .rvx-mobile-category-screen__brand-pill,
  body .rvx-mobile-category-screen__logo{display:none!important;}
  body .rvx-mobile-category-screen__header,
  body .rvx-mobile-category-screen__header.rvx-mobile-category-screen__header--compact{
    display:grid!important;grid-template-columns:40px minmax(0,1fr)!important;align-items:center!important;
    gap:10px!important;padding:10px 12px 9px!important;min-height:0!important;
    border-bottom:1px solid #eef0f3!important;background:#fff!important;
  }
  body .rvx-mobile-category-screen__back{
    order:1!important;display:grid!important;place-items:center!important;
    width:40px!important;height:40px!important;min-width:40px!important;
    border:0!important;border-radius:12px!important;background:#f3f4f6!important;color:#1f2937!important;
  }
  body .rvx-mobile-category-screen__search{order:2!important;min-height:42px!important;height:42px!important;}
  body .rvx-mobile-category-screen__search .rvx-product-search{
    height:42px!important;min-height:42px!important;border-radius:999px!important;
    background:#f3f4f6!important;border-color:transparent!important;padding:0 10px!important;
  }
  body .rvx-mobile-category-screen__search .rvx-product-search:focus-within{
    border-color:#dbe2ea!important;background:#fff!important;box-shadow:0 0 0 3px rgba(37,99,235,.08)!important;
  }
  body .rvx-mobile-category-screen__search .rvx-product-search input{font-size:12px!important;}
  body .rvx-mobile-category-screen__modes{
    padding-inline:12px!important;gap:0!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  body .rvx-mobile-category-screen__mode{
    position:relative!important;height:41px!important;min-height:41px!important;font-size:12px!important;font-weight:760!important;
  }
  body .rvx-mobile-category-screen__mode.is-active{border-bottom:0!important;}
  body .rvx-mobile-category-screen__mode.is-active::after{
    content:""!important;position:absolute!important;right:18%!important;left:18%!important;bottom:0!important;height:2px!important;
    border-radius:999px!important;background:var(--rvx-uni-accent,#245be1)!important;display:block!important;
  }
  body .rvx-mobile-category-screen__body{grid-template-columns:minmax(0,1fr) clamp(88px,26%,102px)!important;}
  body .rvx-mobile-category-pane,
  body .rvx-mobile-category-pane.is-active{animation:rvxMobileDrawerPane .22s ease both!important;}
}
@keyframes rvxMobileDrawerPane{
  from{opacity:0;transform:translateX(8px);}to{opacity:1;transform:none;}
}

@media (max-width:767px){
  .rvx-location-modal{padding:0;align-items:flex-end;}
  .rvx-location-modal__dialog{
    width:100vw;max-width:none;border-radius:22px 22px 0 0;border-bottom:0;
    padding:16px 14px calc(14px + env(safe-area-inset-bottom,0px));
    transform:translateY(20px) scale(1);
  }
  .rvx-location-modal__head h2{font-size:18px;}
  .rvx-location-modal__toolbar{gap:8px;}
  .rvx-location-modal__locate{padding:0 12px;font-size:12px;}
  .rvx-location-modal__map{height:280px;}
}
@media (prefers-reduced-motion:reduce){
  .rvx-location-modal__backdrop,
  .rvx-location-modal__dialog,
  body .rvx-mobile-category-screen,
  body .rvx-mobile-category-pane,
  body .rvx-mobile-category-pane.is-active{transition:none!important;animation:none!important;}
}
