/* ==========================================================================
   macOS-Style Side Drawer & 3D Rotating Coin-Flip Tabs
   ========================================================================== */

/* The floating side wrapper positioned vertically at 50% height */
.mac-side-wrapper {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  pointer-events: none;
}

/* RTL: Attached to the right edge */
.mac-side-wrapper.rtl {
  right: 0;
}

/* LTR: Attached to the left edge */
.mac-side-wrapper.ltr {
  left: 0;
}

/* Sleek Minimal Arrow Trigger Handle (سهم صغير فقط لو لمسه يطلع لبره) */
.mac-dock-trigger {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 48px;
  padding: 0;
  background: rgba(10, 18, 34, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #00e5ff;
  border: 1.5px solid rgba(0, 229, 255, 0.45);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 229, 255, 0.25);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s, box-shadow 0.2s, width 0.25s;
  z-index: 10;
}

.mac-side-wrapper.rtl .mac-dock-trigger {
  right: 0;
  border-right: none;
  border-radius: 24px 0 0 24px;
}

.mac-side-wrapper.ltr .mac-dock-trigger {
  left: 0;
  border-left: none;
  border-radius: 0 24px 24px 0;
}

/* Hover or Touch: slides outward slightly ("لو لمسه يطلع لبره") */
.mac-side-wrapper.rtl .mac-dock-trigger:hover,
.mac-side-wrapper.rtl .mac-dock-trigger:active {
  transform: translateY(-50%) translateX(-6px);
  background: rgba(0, 112, 243, 0.95);
  border-color: #00e5ff;
  color: #fff;
  box-shadow: -4px 0 25px rgba(0, 229, 255, 0.6);
  width: 32px;
}

.mac-side-wrapper.ltr .mac-dock-trigger:hover,
.mac-side-wrapper.ltr .mac-dock-trigger:active {
  transform: translateY(-50%) translateX(6px);
  background: rgba(0, 112, 243, 0.95);
  border-color: #00e5ff;
  color: #fff;
  box-shadow: 4px 0 25px rgba(0, 229, 255, 0.6);
  width: 32px;
}

.mac-arrow-icon {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  color: #00e5ff;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s;
  user-select: none;
}

.mac-dock-trigger:hover .mac-arrow-icon {
  color: #fff;
}

.mac-side-wrapper.active .mac-arrow-icon {
  transform: rotate(180deg);
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 15px #00e5ff; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Backdrop Overlay */
.mac-dock-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 7, 15, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9998;
  pointer-events: none;
}

.mac-side-wrapper.active .mac-dock-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* The macOS Glassmorphic Drawer Window */
.mac-dock-drawer {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 340px;
  max-width: 90vw;
  max-height: 85vh;
  background: rgba(11, 17, 32, 0.94);
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 112, 243, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  z-index: 9999;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
}

.mac-side-wrapper.rtl .mac-dock-drawer {
  right: -360px;
}

.mac-side-wrapper.ltr .mac-dock-drawer {
  left: -360px;
}

/* Active State: Drawer slides in */
.mac-side-wrapper.rtl.active .mac-dock-drawer {
  right: 16px;
  opacity: 1;
  visibility: visible;
}

.mac-side-wrapper.ltr.active .mac-dock-drawer {
  left: 16px;
  opacity: 1;
  visibility: visible;
}

/* macOS Window Header */
.mac-window-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mac-window-dots {
  display: flex;
  gap: 7px;
}

.mac-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.mac-dot-close { background: #ff5f56; }
.mac-dot-min { background: #ffbd2e; }
.mac-dot-max { background: #27c93f; }

.mac-dot:hover {
  transform: scale(1.15);
}

.mac-window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

.mac-apple-icon {
  font-size: 1.1rem;
  color: #94a3b8;
}

.mac-close-x {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.mac-close-x:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ff5f56;
}

/* Mac Status Strip */
.mac-status-bar {
  padding: 8px 18px;
  background: rgba(0, 112, 243, 0.12);
  border-bottom: 1px solid rgba(0, 112, 243, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #93c5fd;
}

.status-live-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

.status-eta {
  margin-right: auto;
  margin-left: 0;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.mac-side-wrapper.ltr .status-eta {
  margin-left: auto;
  margin-right: 0;
}

/* 3D Rotating Coin-Flip Cards Container */
.mac-dock-items-grid {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  perspective: 1000px;
}

/* The 3D Rotating Coin Card */
.mac-coin-card {
  width: 100%;
  cursor: pointer;
  opacity: 0;
  transform: perspective(800px) rotateY(-90deg) scale(0.85);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Active cascade coin-flip animation */
.mac-side-wrapper.active .mac-coin-card {
  animation: coinFlipIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  animation-delay: var(--card-delay, 0s);
}

@keyframes coinFlipIn {
  0% {
    opacity: 0;
    transform: perspective(800px) rotateY(-90deg) scale(0.85);
  }
  70% {
    transform: perspective(800px) rotateY(15deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: perspective(800px) rotateY(0deg) scale(1);
  }
}

.mac-coin-inner {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 12px 14px;
  transition: all 0.25s ease;
}

.mac-coin-front {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mac-card-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(0, 112, 243, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 112, 243, 0.3);
  font-size: 1.35rem;
  transition: transform 0.3s;
}

.mac-card-info {
  flex: 1;
}

.mac-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.mac-card-sub {
  font-size: 0.78rem;
  color: var(--accent);
}

.mac-pill-btn {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.3);
  transition: all 0.2s;
}

/* Hover: Mac Dock Magnification & 3D Tilt */
.mac-coin-card:hover {
  transform: perspective(800px) rotateY(6deg) scale(1.03);
}

.mac-coin-card:hover .mac-coin-inner {
  background: rgba(0, 112, 243, 0.2);
  border-color: rgba(0, 229, 255, 0.4);
  box-shadow: 0 8px 25px rgba(0, 112, 243, 0.25);
}

.mac-coin-card:hover .mac-card-icon-wrap {
  transform: rotate(15deg) scale(1.1);
}

.mac-coin-card:hover .mac-pill-btn {
  background: #0070f3;
  color: #fff;
  border-color: #0070f3;
}

/* Quick Action Anchors inside Dock */
.mac-coin-action .mac-action-anchor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  text-decoration: none;
  color: #fff;
  transition: all 0.25s ease;
}

.mac-coin-action.call-action .mac-action-anchor {
  background: linear-gradient(135deg, rgba(0, 112, 243, 0.3), rgba(0, 229, 255, 0.2));
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.mac-coin-action.wa-action .mac-action-anchor {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(37, 211, 102, 0.2));
  border: 1px solid rgba(37, 211, 102, 0.3);
}

.mac-action-icon {
  font-size: 1.4rem;
}

.mac-action-text {
  flex: 1;
}

.mac-action-text strong {
  display: block;
  font-size: 0.9rem;
}

.mac-action-text small {
  display: block;
  font-size: 0.75rem;
  color: #cbd5e1;
}

.mac-action-arrow {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

/* Mac Dock Footer */
.mac-dock-footer {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.mac-footer-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  transition: color 0.2s;
}

.mac-footer-link:hover {
  color: #fff;
}

