/*
 * containers_3d.css — تصميم الحاويات ثلاثي الأبعاد
 * استوردلي برو v2 — مايو 2026
 *
 * يحاكي الحاوية البحرية بـ:
 *  - إطار معدني 3D
 *  - لمبة LED ملونة
 *  - أرضية + شرائط تحذير
 *  - قاعدة بيانات (رقم الحاوية + مؤشر الإقبال)
 *
 * 6 ألوان متناوبة بناءً على data-color-idx (0..5)
 * RTL friendly + responsive كامل
 */

/* ============================
   شبكة الحاويات
   ============================ */
.cnt3d-grid {
  display: grid;
  gap: 18px;
  padding: 8px 0;
  direction: rtl;
}

.cnt3d-cols-6 { grid-template-columns: repeat(6, 1fr); }
.cnt3d-cols-5 { grid-template-columns: repeat(5, 1fr); }
.cnt3d-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cnt3d-cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1280px) { .cnt3d-cols-6 { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1080px) { .cnt3d-cols-6, .cnt3d-cols-5 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 880px)  { .cnt3d-cols-6, .cnt3d-cols-5, .cnt3d-cols-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px)  { .cnt3d-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 420px)  { .cnt3d-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* ============================
   البطاقة الأم
   ============================ */
.cnt3d-card {
  --c-led: #10b981;
  --c-led-glow: rgba(16, 185, 129, .55);
  --c-fill: #10b981;
  --c-cat-bg: #0f172a;

  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.2),
              box-shadow .35s ease,
              filter .25s ease;
  background: #0a0f1c;
  box-shadow: 0 6px 20px rgba(0,0,0,.18),
              0 1px 0 rgba(255,255,255,.04) inset;
  position: relative;
  isolation: isolate;
  font-family: inherit;
}

.cnt3d-card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: 0 16px 38px rgba(0,0,0,.32),
              0 0 0 1px var(--c-led-glow),
              0 0 28px var(--c-led-glow);
}

.cnt3d-card:focus-visible {
  outline: 3px solid var(--c-led);
  outline-offset: 3px;
}

/* ألوان الحاويات (6 خيارات بالتناوب) */
.cnt3d-card[data-color-idx="0"] { /* أخضر */
  --c-led: #10b981; --c-led-glow: rgba(16, 185, 129, .55); --c-fill: #10b981;
}
.cnt3d-card[data-color-idx="1"] { /* بنفسجي */
  --c-led: #a855f7; --c-led-glow: rgba(168, 85, 247, .55); --c-fill: #a855f7;
}
.cnt3d-card[data-color-idx="2"] { /* برتقالي */
  --c-led: #f97316; --c-led-glow: rgba(249, 115, 22, .55); --c-fill: #f97316;
}
.cnt3d-card[data-color-idx="3"] { /* تركوازي */
  --c-led: #06b6d4; --c-led-glow: rgba(6, 182, 212, .55); --c-fill: #06b6d4;
}
.cnt3d-card[data-color-idx="4"] { /* أزرق */
  --c-led: #3b82f6; --c-led-glow: rgba(59, 130, 246, .55); --c-fill: #3b82f6;
}
.cnt3d-card[data-color-idx="5"] { /* أحمر */
  --c-led: #ef4444; --c-led-glow: rgba(239, 68, 68, .55); --c-fill: #ef4444;
}

/* ============================
   الشريط العلوي: اسم القسم
   ============================ */
.cnt3d-header {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: relative;
}

.cnt3d-header::before,
.cnt3d-header::after {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.4);
}
.cnt3d-header::before { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.cnt3d-header::after  { position: absolute; left:  8px; top: 50%; transform: translateY(-50%); }

.cnt3d-cat-name {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: calc(100% - 30px);
}
.cnt3d-arrow {
  font-size: 16px;
  opacity: .8;
  font-weight: 900;
}

/* ============================
   جسم الحاوية (الجزء البصري)
   ============================ */
.cnt3d-body {
  position: relative;
  height: 240px;
  background:
    /* تدرج المعدن الداخلي */
    linear-gradient(180deg,
      rgba(0,0,0,.6) 0%,
      rgba(15,23,42,.85) 8%,
      rgba(15,23,42,.95) 35%,
      rgba(20,30,50,.98) 100%);
  overflow: hidden;
}

/* الجدران المموجة (corrugated walls) — اليمين والشمال */
.cnt3d-body::before,
.cnt3d-body::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,.06) 0px,
    rgba(255,255,255,.06) 2px,
    rgba(0,0,0,.4) 4px,
    rgba(0,0,0,.4) 6px
  );
  z-index: 2;
}
.cnt3d-body::before { right: 0; box-shadow: inset -2px 0 4px rgba(0,0,0,.6); }
.cnt3d-body::after  { left:  0; box-shadow: inset  2px 0 4px rgba(0,0,0,.6); }

/* شريط البراند ESTAWREDLY */
.cnt3d-brand-strip {
  position: absolute;
  top: 8px;
  right: 24px;
  left: 24px;
  background: linear-gradient(90deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  color: rgba(255,255,255,.55);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 3px;
  padding: 3px 0;
  text-align: center;
  z-index: 3;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  font-family: 'Arial', sans-serif;
}

/* لمبة LED */
.cnt3d-led {
  position: absolute;
  top: 26px;
  right: 32px;
  left: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--c-led);
  box-shadow:
    0 0 12px var(--c-led-glow),
    0 0 24px var(--c-led-glow),
    0 0 40px var(--c-led-glow),
    0 2px 30px var(--c-led);
  z-index: 3;
  animation: cnt3d-led-pulse 3s ease-in-out infinite;
}

@keyframes cnt3d-led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .7; }
}

/* الإضاءة الداخلية (انعكاس اللمبة على الجدران) */
.cnt3d-body > .cnt3d-interior {
  position: absolute;
  top: 36px;
  right: 14px;
  left: 14px;
  bottom: 28px;
  background:
    radial-gradient(ellipse at top,
      var(--c-led-glow) 0%,
      transparent 40%),
    linear-gradient(180deg,
      rgba(0,0,0,.2) 0%,
      transparent 30%,
      rgba(0,0,0,.5) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* الأيقونة/المنتج داخل الحاوية */
.cnt3d-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80%;
  height: 80%;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.6));
}
.cnt3d-icon-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.55));
}
.cnt3d-emoji {
  font-size: 70px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.6));
}

@media (max-width: 680px) {
  .cnt3d-emoji { font-size: 52px; }
  .cnt3d-body { height: 200px; }
  .cnt3d-brand-strip { font-size: 8px; letter-spacing: 2px; }
}
@media (max-width: 420px) {
  .cnt3d-emoji { font-size: 44px; }
  .cnt3d-body { height: 180px; }
}

/* أرضية الحاوية (ظل سفلي) */
.cnt3d-floor {
  position: absolute;
  bottom: 12px;
  right: 14px;
  left: 14px;
  height: 14px;
  background:
    linear-gradient(180deg,
      rgba(0,0,0,.6) 0%,
      rgba(0,0,0,.85) 100%);
  border-top: 1px solid rgba(255,255,255,.04);
  z-index: 2;
}

/* شرائط التحذير الصفراء/السوداء */
.cnt3d-hazard {
  position: absolute;
  bottom: 0;
  right: 14px;
  left: 14px;
  height: 12px;
  background: repeating-linear-gradient(
    -45deg,
    #fbbf24 0px,
    #fbbf24 8px,
    #1f2937 8px,
    #1f2937 16px
  );
  z-index: 3;
  border-top: 1px solid rgba(0,0,0,.5);
  box-shadow: 0 -1px 4px rgba(0,0,0,.5) inset;
}

/* ============================
   القاعدة: رقم الحاوية + مؤشر الإقبال
   ============================ */
.cnt3d-footer {
  background: linear-gradient(180deg, #0f1729 0%, #0a1020 100%);
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255,255,255,.05);
}

.cnt3d-number-row {
  text-align: center;
  margin-bottom: 6px;
}
.cnt3d-number-label {
  display: block;
  color: rgba(226, 232, 240, .65);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
}
.cnt3d-number-val {
  display: block;
  color: #f8fafc;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
}

.cnt3d-fill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 6px;
  font-size: 11px;
}
.cnt3d-fill-label {
  color: rgba(226, 232, 240, .55);
  font-weight: 600;
}
.cnt3d-fill-pct {
  color: var(--c-fill);
  font-weight: 800;
  text-shadow: 0 0 6px var(--c-led-glow);
}

.cnt3d-fill-bar {
  background: rgba(255,255,255,.06);
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.cnt3d-fill-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--c-fill), var(--c-led));
  border-radius: 999px;
  box-shadow: 0 0 8px var(--c-led-glow);
  transition: width .8s cubic-bezier(.2,.9,.3,1);
  animation: cnt3d-fill-shine 2.5s linear infinite;
  background-size: 200% 100%;
}

@keyframes cnt3d-fill-shine {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ============================
   دعم وضع التطبيق على بطاقات قديمة
   (للحالة لو الـ JS ضيف الـ classes على بطاقات موجودة)
   ============================ */
.cnt3d-applied {
  /* محجوز للـ JS */
}

/* احترام تفضيل المستخدم لتقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  .cnt3d-card,
  .cnt3d-led,
  .cnt3d-fill-bar > span {
    animation: none !important;
    transition: none !important;
  }
}

/* تحسينات الطباعة */
@media print {
  .cnt3d-card { box-shadow: none; border: 1px solid #ccc; }
  .cnt3d-led, .cnt3d-fill-bar > span { animation: none; }
}

/* ============================
   عناصر مساعدة للهيدر (شارة العملة)
   ============================ */
.ep-currency-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, .08);
  border: 1px solid rgba(15, 118, 110, .25);
  color: #0f766e;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
}
.ep-currency-badge:hover {
  background: rgba(15, 118, 110, .15);
  transform: translateY(-1px);
}
.ep-currency-badge .ep-flag { font-size: 16px; line-height: 1; }
.ep-currency-badge .ep-code { letter-spacing: .5px; }
.ep-currency-badge::after {
  content: "▾";
  font-size: 10px;
  opacity: .6;
  margin-right: 2px;
}

/* قائمة الدول المنسدلة */
.ep-country-menu {
  position: absolute;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  padding: 8px;
  min-width: 220px;
  z-index: 9999;
  display: none;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,.06);
}
.ep-country-menu.open { display: block; }
.ep-country-menu .ep-country-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
  font-size: 13px;
  color: #0f172a;
  font-weight: 600;
}
.ep-country-menu .ep-country-item:hover { background: rgba(15, 118, 110, .08); }
.ep-country-menu .ep-country-item.active { background: rgba(15, 118, 110, .12); color: #0f766e; }
.ep-country-menu .ep-country-item .ep-flag { font-size: 18px; }
.ep-country-menu .ep-country-item .ep-name { flex: 1; }
.ep-country-menu .ep-country-item .ep-cur  { font-size: 11px; opacity: .6; font-family: monospace; }

/* تنبيه التحويل */
.ep-currency-notice {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0f766e;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 99999;
  animation: ep-notice-slide-in .3s ease;
}
@keyframes ep-notice-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* WAVE_SUBFIX_PE_V1: طبقة أمان — أي قائمة دول غير مفتوحة عمداً لا تحجب النقرات */
.ep-country-menu:not(.open) { pointer-events: none !important; display: none !important; }
.ep-currency-notice:empty { display: none !important; }
