/* =====================================================
   Cadibo SHEIN Mega Menu — Frontend Styles
   ===================================================== */

/* Reset & Base */
.cadibo-shein-menu *,
.cadibo-shein-mega *,
.cadibo-shein-mobile-drawer * {
  box-sizing: border-box;
}

.cadibo-shein-menu {
  position: relative;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

/* =====================================================
   BARA NEAGRA
   ===================================================== */
.cadibo-shein-bar {
  display: flex;
  align-items: center;
  background: #002153;
  color: #fff;
  height: 48px;
  position: relative;
}

/* Buton Categorii */
.cadibo-shein-categories-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  height: 100%;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  user-select: none;
  transition: background 0.15s;
}

.cadibo-shein-categories-btn:hover,
.cadibo-shein-categories-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.csm-btn-icon svg,
.csm-btn-arrow svg {
  display: block;
  flex-shrink: 0;
}

.csm-btn-icon { width: 18px; height: 18px; }
.csm-btn-arrow { width: 14px; height: 14px; }

.csm-btn-text {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* =====================================================
   LISTA ORIZONTALA CATEGORII (topbar)
   ===================================================== */
.csm-topbar-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.csm-topbar-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  height: 100%;
  display: flex;
  align-items: center;
}

.csm-topbar-scroll::-webkit-scrollbar { display: none; }

.csm-topbar-link {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 400;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.csm-topbar-link:hover,
.csm-topbar-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
}

.csm-scroll-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0 8px;
  height: 48px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.2s;
}

.csm-scroll-btn:hover { background: rgba(255, 255, 255, 0.1); }
.csm-scroll-btn svg { display: block; width: 18px; height: 18px; }
.csm-scroll-left { opacity: 0.4; }

/* =====================================================
   HAMBURGER MOBILE
   ===================================================== */
.csm-hamburger {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
}

/* =====================================================
   MOBILE MENU TRIGGER (bara mobil ≤782px)
   ===================================================== */
.cadibo-mobile-menu-trigger {
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  min-height: 52px;
  gap: 12px;
  text-align: left;
}

.cadibo-mobile-menu-trigger-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cadibo-mobile-menu-label {
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.cadibo-mobile-menu-icon svg {
  display: block;
  width: 22px;
  height: 22px;
}

.cadibo-mobile-menu-chevron {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  transition: transform 0.25s ease;
}

.cadibo-mobile-menu-chevron svg {
  display: block;
  width: 20px;
  height: 20px;
}

.csm-hamburger[aria-expanded="true"] .cadibo-mobile-menu-chevron {
  transform: rotate(180deg);
}

/* =====================================================
   MEGA MENU DESKTOP
   ===================================================== */
.cadibo-shein-mega {
  position: fixed;
  left: 0;
  right: 0;
  top: 0; /* set via JS */
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.13);
  border-top: 1px solid #e8e8e8;
  z-index: 10200;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  visibility: hidden;
  margin-left:auto;
  margin-right:auto;
  max-width:1200px;
}

.cadibo-shein-mega.is-open {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.csm-mega-inner {
  display: flex;
  max-height: 540px;
  overflow: hidden;
  max-width: 1200px;
  margin: 0 auto;
}

/* --- Panoul stang (lista categorii) --- */
.csm-mega-left {
  width: 230px;
  flex-shrink: 0;
  border-right: 1px solid #f0f0f0;
  overflow-y: auto;
  background: #fafafa;
}

.csm-mega-left::-webkit-scrollbar { width: 4px; }
.csm-mega-left::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.csm-mega-cat-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.csm-mega-cat-item { border-bottom: 1px solid #f2f2f2; }

.csm-mega-cat-item.is-active { background: #d1cdcd; }
.csm-mega-cat-item.is-active .csm-mega-cat-link { color: #000; font-weight: 500; }

.csm-mega-cat-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px 11px 16px;
  text-decoration: none;
  color: #333;
  font-size: 16px;
  transition: background 0.12s;
}

.csm-mega-cat-link:hover,
.csm-mega-cat-link:focus-visible {
  background: #d1cdcd;
  color: #000;
  outline: none;
}

.csm-mega-cat-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.csm-cat-arrow {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.35;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
}

.csm-cat-arrow svg { width: 14px; height: 14px; display: block; }

/* --- Panoul drept (subcategorii) --- */
.csm-mega-right {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 24px;
  min-width: 0;
}

.csm-mega-right::-webkit-scrollbar { width: 4px; }
.csm-mega-right::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.csm-mega-panel { display: none; }
.csm-mega-panel.is-active { display: block; }

.csm-mega-groups {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: stretch;
}

.csm-mega-group {
  flex: 0 0 auto;
  width: 100%;
}

.csm-group-title {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
  padding-bottom: 7px;
  border-bottom: 2px solid #111;
  white-space: nowrap;
}

.csm-group-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, 120px);
  gap: 14px 12px;
  justify-content: start;
  align-items: start;
}

/* Sectiunea "Categorii" (leaf nodes) — acelasi grid responsive */
.csm-leaf-section .csm-group-items {
  grid-template-columns: repeat(auto-fill, 120px);
}

.csm-group-item { width: 120px; }

/* --- Item (imagine rotunda + label) --- */
.csm-item-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #444;
}

.csm-item-link:hover .csm-item-img-wrap { border-color: #000; }
.csm-item-link:hover .csm-item-label { color: #000; }

.csm-item-img-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.csm-item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.csm-item-img-wrap svg { width: 28px; height: 28px; }

.csm-item-label {
  font-size: 13px;
  line-height: 1.25;
  color: #555;
  text-align: center;
  max-width: 112px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.12s;
}

/* "Vezi toate" item */
.csm-item-see-all .csm-item-img-wrap {
  background: #f5f8ff;
}

.csm-item-see-all .csm-item-img-wrap svg { color: #0b5bc7; }

.csm-item-see-all .csm-item-label { font-weight: 600; color: #0b5bc7; }

.csm-item-see-all .csm-item-link:hover .csm-item-img-wrap {
  background: #e6eeff;
  border-color: #0b5bc7;
}

/* Grid icon used as placeholder */
.csm-grid-icon { color: #aaa; }
.csm-grid-icon svg { width: 28px; height: 28px; }

.csm-panel-empty {
  padding: 24px;
}

.csm-see-all-link {
  font-size: 15px;
  font-weight: 600;
  color: #000;
  text-decoration: none;
}

/* =====================================================
   OVERLAY
   ===================================================== */
.csm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  z-index: 5200;
  backdrop-filter: blur(1px);
}

.csm-overlay.is-open { display: block; }

/* =====================================================
   MOBILE DRAWER
   ===================================================== */
.cadibo-shein-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 85vw;
  max-width: 390px;
  height: 100%;
  background: #fff;
  z-index: 5300;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cadibo-shein-mobile-drawer.is-open { transform: translateX(0); }

body.cadibo-mobile-menu-open { overflow: hidden !important; }

/* Header drawer */
.csm-drawer-header {
  display: flex;
  align-items: center;
  padding: 0 8px 0 4px;
  height: 54px;
  border-bottom: 1px solid #efefef;
  flex-shrink: 0;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.csm-drawer-back,
.csm-drawer-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
  flex-shrink: 0;
}

.csm-drawer-back:hover,
.csm-drawer-close:hover { background: #f5f5f5; }

.csm-drawer-back svg,
.csm-drawer-close svg { display: block; width: 20px; height: 20px; }

.csm-is-hidden { visibility: hidden; }

.csm-drawer-title {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ecrane drawer */
.csm-drawer-screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: none;
}

.csm-drawer-screen.is-active { display: block; }

/* Lista categorii principale (ecranul main) */
.csm-drawer-main-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.csm-drawer-main-item { border-bottom: 1px solid #f5f5f5; }

.csm-drawer-cat-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.csm-drawer-cat-btn:hover { background: #fafafa; }
.csm-drawer-cat-btn svg { width: 16px; height: 16px; color: #bbb; flex-shrink: 0; }

.csm-drawer-cat-img-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.csm-drawer-cat-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.csm-drawer-cat-placeholder svg { width: 24px; height: 24px; color: #bbb; }

.csm-drawer-cat-label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #222;
  line-height: 1.35;
}

/* Grupe in ecranul categoriei */
.csm-drawer-groups { padding: 12px 16px 24px; }

.csm-drawer-group { margin-bottom: 24px; }

.csm-drawer-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
  padding-bottom: 7px;
  border-bottom: 2px solid #111;
}

.csm-drawer-group-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--csm-cols-mobile, 3), 1fr);
  gap: 12px 8px;
}

.csm-drawer-group-item { text-align: center; }

.csm-drawer-item-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #444;
}

.csm-drawer-item-link:hover .csm-drawer-item-img-wrap { border-color: #000; }

.csm-drawer-item-img-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.csm-drawer-item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.csm-drawer-item-img-wrap svg { width: 24px; height: 24px; }

.csm-drawer-item-placeholder svg { color: #bbb; }

.csm-drawer-item-label {
  font-size: 12px;
  line-height: 1.3;
  color: #555;
  text-align: center;
}

/* "Vezi toate" mobile */
.csm-drawer-group-item.csm-item-see-all .csm-drawer-item-img-wrap {
  background: #f5f8ff;
  border: 2px solid #0b5bc7;
}

.csm-drawer-group-item.csm-item-see-all .csm-drawer-item-img-wrap svg { color: #0b5bc7; }

.csm-drawer-group-item.csm-item-see-all .csm-drawer-item-label {
  font-weight: 600;
  color: #0b5bc7;
}

.csm-drawer-empty {
  padding: 24px 16px;
}

.csm-drawer-empty a {
  font-size: 15px;
  font-weight: 600;
  color: #000;
  text-decoration: none;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 782px) {
  .cadibo-shein-categories-btn,
  .csm-topbar-wrapper {
    display: none !important;
  }

  .csm-hamburger { display: flex !important; }
  .cadibo-mobile-menu-trigger { flex: 1 1 auto; width: 100%; }
}

@media (min-width: 783px) {
  .csm-hamburger { display: none !important; }

  /* Drawer: ramas in DOM (position:fixed, off-screen via transform).
     Permite deschiderea via .open-cadibo-mobile-menu fara display:none. */
  .csm-overlay:not(.is-open) { display: none !important; }
}

/* grid-template-columns este acum repeat(auto-fill, 120px) —
   nu mai avem nevoie de override-uri pe breakpoint-uri */

/* Touch device: elim hover effects care pot ramine active */
@media (hover: none) {
  .csm-item-link:hover .csm-item-img-wrap { border-color: transparent; }
  .csm-item-link:hover .csm-item-label { color: #555; }
}
