/* ========== Works Section (Fixed Phone Style) ========== */
:root {
  --bg: #0b1020;
  --radius: 22px;
}

#worksShow {
  padding: 64px 0;
  overflow: hidden;
  position: relative;
}

#worksShow .container {
  max-width: 1280px;
  margin-inline: auto;
  padding: 0 18px;
}

/* Tabs */
.ws-switch {
  display: flex; gap: 10px; justify-content: center; margin-bottom: 12px;
  position: relative; z-index: 10; flex-wrap: wrap;
}
.ws-tab {
  border: 1px solid rgba(255,255,255,0.15); border-radius: 999px;
  padding: 10px 18px; font-weight: 800; background: rgba(255,255,255,0.05);
  color: #ccc; cursor: pointer; transition: all 0.3s ease;
}
.ws-tab.is-active {
  background: linear-gradient(90deg, #9b5cf3, #66a3ff);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 15px rgba(155, 92, 243, 0.4);
}
.ws-title {
  color: #fff; text-align: center; margin: 12px 0 30px;
  font-weight: 900; font-size: 1.5rem;
}

/* Stage */
.ws-stage {
  position: relative; perspective: 1200px;
  width: 100%; padding-top: 20px;
  user-select: none; -webkit-user-select: none;
}

/* Track */
.ws-track {
  position: relative; height: 540px; width: 100%;
  transform-style: preserve-3d;
  touch-action: pan-y pinch-zoom; /* إصلاح سكرول الموبايل */
}
.ws-track.dragging { cursor: grabbing; }

/* === Cards Base Style === */
.ws-card {
  position: absolute; inset: 0; margin: auto;
  border-radius: var(--radius);
  /* transition settings */
  will-change: transform, opacity;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s, filter 0.5s;
  text-decoration: none; color: inherit;
  
  /* الوضع الافتراضي (ويب) */
  width: min(900px, 85vw); height: 500px;
  background: #0f162a; border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; overflow: hidden;
}

/* === 3D Transforms === */
/* الويب: كارد عريض */
.ws-track[data-mode="web"] .ws-card[data-pos="0"] { transform: translate3d(0,0,0); z-index: 10; opacity: 1; }
.ws-track[data-mode="web"] .ws-card[data-pos="1"] { transform: translate3d(15%,0,-200px) rotateY(-5deg); z-index: 5; opacity: 0.7; filter: brightness(0.6); pointer-events: none; }
.ws-track[data-mode="web"] .ws-card[data-pos="-1"] { transform: translate3d(-15%,0,-200px) rotateY(5deg); z-index: 5; opacity: 0.7; filter: brightness(0.6); pointer-events: none; }

/* التطبيقات: كارد شفاف والتحكم بالهاتف */
.ws-track[data-mode="apps"] { height: 600px; } /* ارتفاع أكبر للتطبيقات */

.ws-track[data-mode="apps"] .ws-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 100%; height: 100%; /* الكارد يأخذ المساحة، والهاتف يتوسطه */
  align-items: center; justify-content: center;
  overflow: visible;
}

.ws-track[data-mode="apps"] .ws-card[data-pos="0"] { transform: translate3d(0,0,0); z-index: 10; opacity: 1; }
.ws-track[data-mode="apps"] .ws-card[data-pos="1"] { transform: translate3d(25%,0,-200px) rotateY(-5deg); z-index: 5; opacity: 0.7; }
.ws-track[data-mode="apps"] .ws-card[data-pos="-1"] { transform: translate3d(-25%,0,-200px) rotateY(5deg); z-index: 5; opacity: 0.7; }

/* إخفاء الباقي */
.ws-card[data-pos="2"], .ws-card[data-pos="-2"] { transform: translate3d(0,0,-500px); opacity: 0; z-index: 0; pointer-events: none; }


/* === Web Content (Chrome Style) === */
.ws-card .chrome {
  height: 40px; background: #0c1223; display: flex; align-items: center;
  padding: 0 16px; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ws-dots { display: flex; gap: 6px; }
.ws-dot { width: 10px; height: 10px; border-radius: 50%; background: #333; }
.ws-dot.r { background: #ff5f57; } .ws-dot.y { background: #febc2e; } .ws-dot.g { background: #28c840; }
.ws-address {
  margin-right: 12px; font-size: 12px; color: #667;
  background: #080b14; padding: 4px 12px; border-radius: 4px; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.ws-media.web { flex: 1; overflow: hidden; }
.ws-media.web img { width: 100%; height: 100%; object-fit: cover; }


/* === PHONE Style (iPhone Look) - رجعنا الكود القديم === */
.ws-phone {
  position: relative;
  width: min(300px, 80vw); /* عرض الهاتف */
  aspect-ratio: 9/19;
  border-radius: 46px;
  background: linear-gradient(180deg, #0b0f19, #0e1424);
  border: 1px solid #1f2538;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  margin: auto;
  overflow: hidden;
  /* حركة عند الهوفر */
  transition: transform 0.4s ease;
}

.ws-track[data-mode="apps"] .ws-card[data-pos="0"]:hover .ws-phone {
  transform: scale(1.03);
}

.ws-island {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 38%; height: 24px; border-radius: 20px;
  background: #0a0f16; border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55); z-index: 10;
}
.ws-island .speaker {
  position: absolute; left: 14px; right: 34px; top: 50%; transform: translateY(-50%);
  height: 6px; border-radius: 3px; background: #0d1526;
}
.ws-island .cam {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: #000;
  box-shadow: 0 0 0 2px #101725, inset 0 0 2px #1e3a8a;
}

.ws-screen {
  position: absolute; inset: 12px; border-radius: 36px;
  overflow: hidden; background: #090f1a;
}
.ws-screen img { width: 100%; height: 100%; object-fit: cover; }


/* Navigation Buttons */
.ws-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(15, 22, 42, 0.8); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.ws-prev { left: 20px; }
.ws-next { right: 20px; }

/* Mobile Responsive */
@media (max-width: 768px) {
  .ws-track { height: 460px; }
  /* الويب يصغر في الموبايل */
  .ws-card { width: 85vw; height: 350px; }
  
  /* التطبيقات تحتاج ارتفاع كامل */
  .ws-track[data-mode="apps"] { height: 500px; }
  .ws-phone { width: 240px; } /* تصغير عرض الجوال في الشاشات الصغيرة */
  
  .ws-prev { left: 5px; } .ws-next { right: 5px; }
}