/* ═══════════════════════════════════════════════════════════════
   MORVO — macOS DESKTOP EXPERIENCE
   Lapisan di atas tahoe.css: wallpaper, menu bar, window chrome,
   dock, dan penyesuaian layout SPA menjadi "aplikasi macOS".
   ═══════════════════════════════════════════════════════════════ */

/* ── Wallpaper desktop (light) ─────────────────────────────── */
body.macos {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: #E9ECF4;
  background-image:
    radial-gradient(45% 55% at 12% 6%,  rgba(124, 158, 255, 0.55), rgba(124, 158, 255, 0) 70%),
    radial-gradient(40% 50% at 88% 10%, rgba(255, 178, 120, 0.40), rgba(255, 178, 120, 0) 70%),
    radial-gradient(55% 65% at 86% 90%, rgba(188, 142, 255, 0.48), rgba(188, 142, 255, 0) 70%),
    radial-gradient(45% 55% at 14% 94%, rgba(118, 208, 255, 0.42), rgba(118, 208, 255, 0) 70%),
    linear-gradient(160deg, #EDF0F9 0%, #F6F1FB 100%);
  background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
  body.macos {
    background-color: #05060B;
    background-image:
      radial-gradient(45% 55% at 12% 6%,  rgba(58, 88, 186, 0.50), rgba(58, 88, 186, 0) 70%),
      radial-gradient(40% 50% at 88% 10%, rgba(150, 84, 42, 0.32), rgba(150, 84, 42, 0) 70%),
      radial-gradient(55% 65% at 86% 90%, rgba(112, 72, 198, 0.42), rgba(112, 72, 198, 0) 70%),
      radial-gradient(45% 55% at 14% 94%, rgba(42, 108, 164, 0.38), rgba(42, 108, 164, 0) 70%),
      linear-gradient(160deg, #0A0C15 0%, #0E0A18 100%);
  }
}

/* ═══ MENU BAR ═══ */
#macMenuBar {
  flex: 0 0 auto;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: rgba(246, 246, 250, 0.55);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.10);
  position: relative;
  z-index: 300;
  user-select: none;
  -webkit-user-select: none;
}
@media (prefers-color-scheme: dark) {
  #macMenuBar {
    background: rgba(22, 22, 26, 0.55);
    border-bottom-color: rgba(255, 255, 255, 0.10);
  }
}
.mb-side { display: flex; align-items: center; height: 100%; gap: 2px; }
.mb-item {
  display: flex; align-items: center; height: 100%;
  padding: 0 9px; border-radius: 5px;
  color: var(--text); text-decoration: none;
}
.mb-item:hover { background: rgba(0, 0, 0, 0.07); }
@media (prefers-color-scheme: dark) { .mb-item:hover { background: rgba(255, 255, 255, 0.10); } }
.mb-apple { padding: 0 8px; }
.mb-apple svg { display: block; }
.mb-appname { font-weight: 700; letter-spacing: -0.01em; }
.mb-icon .material-symbols-outlined { font-size: 15px; color: var(--text); }
.mb-clock { font-variant-numeric: tabular-nums; font-weight: 500; }

/* Dropdown menu */
.mb-menu { position: relative; height: 100%; display: flex; align-items: stretch; }
.mb-menu > .mb-label { display: flex; align-items: center; height: 100%; padding: 0 9px; border-radius: 5px; cursor: default; }
.mb-menu:hover > .mb-label, .mb-menu:focus-within > .mb-label { background: rgba(0, 0, 0, 0.07); }
@media (prefers-color-scheme: dark) { .mb-menu:hover > .mb-label, .mb-menu:focus-within > .mb-label { background: rgba(255, 255, 255, 0.10); } }
.mb-drop {
  display: none;
  position: absolute; top: 100%; left: 0;
  min-width: 210px;
  padding: 5px;
  background: rgba(250, 250, 253, 0.82);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
}
.mb-menu:hover .mb-drop, .mb-menu:focus-within .mb-drop { display: block; }
@media (prefers-color-scheme: dark) {
  .mb-drop { background: rgba(38, 38, 44, 0.85); border-color: rgba(255, 255, 255, 0.14); box-shadow: 0 10px 34px rgba(0,0,0,0.5); }
}
.mb-drop-item {
  display: block;
  padding: 5px 10px;
  font-size: 12.5px; font-weight: 400;
  color: var(--text); text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}
.mb-drop-item:hover { background: var(--accent); color: #fff !important; }
.mb-drop-sep { height: 0.5px; background: var(--sep-strong); margin: 5px 10px; }

/* ═══ APP WINDOW ═══ */
@keyframes macWinIn {
  from { opacity: 0; transform: scale(0.985) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
#macWindow {
  flex: 1 1 auto;
  min-height: 0;
  width: min(1200px, calc(100% - 48px));
  margin: 20px auto 88px; /* ruang bawah untuk dock */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 0.5px solid rgba(0, 0, 0, 0.16);
  border-radius: 14px;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.08),
    0 34px 90px rgba(15, 23, 42, 0.32),
    0 10px 28px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  animation: macWinIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.05s backwards;
  transition: margin var(--t-slow), width var(--t-slow), border-radius var(--t-slow);
}
@media (prefers-color-scheme: dark) {
  #macWindow { border-color: rgba(255, 255, 255, 0.14); box-shadow: 0 0 0 0.5px rgba(0,0,0,0.4), 0 28px 80px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.4); }
}
/* Zoom (tombol hijau) — window hampir penuh layar */
body.macos-zoom #macWindow {
  width: calc(100% - 12px);
  margin: 6px auto 78px;
  border-radius: 12px;
}

/* Title bar */
.mac-titlebar {
  flex: 0 0 auto;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  position: relative;
  background: rgba(246, 246, 250, 0.70);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid var(--sep);
}
@media (prefers-color-scheme: dark) {
  .mac-titlebar { background: rgba(30, 30, 34, 0.70); }
}
.mac-win-title {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.01em;
  max-width: 46%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
/* Traffic lights — warna dari tahoe.css, glyph hover di sini */
.tl { position: relative; cursor: pointer; border: none; padding: 0; }
.tl::after {
  content: '';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; line-height: 1;
  color: rgba(0, 0, 0, 0.55);
  opacity: 0; transition: opacity 0.1s ease;
}
.tlights:hover .tl::after { opacity: 1; }
.tl-r::after { content: '\2715'; font-size: 7.5px; }
.tl-y::after { content: '\2013'; font-size: 10px; padding-bottom: 1px; }
.tl-g::after { content: '+'; font-size: 9px; }
.tl:active { filter: brightness(0.9); }

/* Tombol title bar (sidebar & share) */
#macSidebarBtn, #macShareBtn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 26px;
  border: none; border-radius: 7px;
  background: transparent; cursor: pointer;
  transition: background var(--t);
}
#macSidebarBtn:hover, #macShareBtn:hover { background: var(--fill-2); }
#macSidebarBtn .material-symbols-outlined, #macShareBtn .material-symbols-outlined {
  font-size: 19px; color: var(--text-2);
}
#macShareBtn { margin-left: auto; }
#macShareBtn.copied .material-symbols-outlined { color: var(--green); }

/* Isi window — area scroll SPA */
.mac-win-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.mac-win-body #app { min-height: 100%; }

/* Template yang pakai tinggi viewport → ikut tinggi window body */
.mac-win-body .h-screen { height: 100% !important; }
.mac-win-body .min-h-screen { min-height: 100% !important; }

/* ═══ DOCK ═══ */
#macDock {
  position: fixed;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(246, 246, 250, 0.42);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.14);
  animation: macDockIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s backwards;
}
@keyframes macDockIn {
  from { opacity: 0; transform: translate(-50%, 26px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-color-scheme: dark) {
  #macDock {
    background: rgba(30, 30, 36, 0.45);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}
.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  transform-origin: 50% 100%;
  transition: transform 0.12s ease-out;
}
.dock-ico {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  border: 0.5px solid rgba(0, 0, 0, 0.12);
}
.dock-ico .material-symbols-outlined { font-size: 24px; color: #fff; }
.di-blue   { background: linear-gradient(180deg, #5AA9FF 0%, #0A6CFF 100%); }
.di-mail   { background: linear-gradient(180deg, #3FC6FF 0%, #0A84FF 100%); }
.di-purple { background: linear-gradient(180deg, #9A86FF 0%, #5E5CE6 100%); }
.di-orange { background: linear-gradient(180deg, #FFB648 0%, #FF9500 100%); }
.di-pink   { background: linear-gradient(180deg, #FF7186 0%, #FF2D55 100%); }
.di-indigo { background: linear-gradient(180deg, #7C8BFF 0%, #3949DB 100%); }
.di-dark   { background: linear-gradient(180deg, #48484E 0%, #1C1C1E 100%); }
.dock-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: transparent; margin-top: 3px;
}
.dock-item.active .dock-dot { background: var(--text-2); }
.dock-sep {
  width: 0.5px; align-self: stretch;
  margin: 4px 5px;
  background: var(--sep-strong);
}
/* Tooltip dock */
.dock-tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%; transform: translateX(-50%);
  padding: 4px 10px;
  background: rgba(28, 28, 30, 0.88);
  color: #F5F5F7;
  font-size: 12px; font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease;
  border: 0.5px solid rgba(255, 255, 255, 0.12);
}
.dock-item:hover .dock-tip { opacity: 1; }

/* ═══ OVERRIDE ELEMEN LAMA ═══ */
/* Hamburger digantikan tombol sidebar di title bar */
body.macos #hamburgerBtn { display: none !important; }

/* Toast naik di atas dock */
body.macos .toast-container { bottom: 96px !important; }

/* Language switcher tetap pojok kanan bawah */
body.macos #langSwitcherBtn { bottom: 18px !important; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  #macDock { display: none; }
  body.macos .toast-container { bottom: 24px !important; }
}
@media (max-width: 767px) {
  /* Window full-bleed ala aplikasi mobile */
  #macWindow,
  body.macos-zoom #macWindow {
    width: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .mac-titlebar { height: 40px; }
  .mac-win-title { max-width: 40%; font-size: 12.5px; }
  /* Menu bar ringkas */
  #macMenuBar { padding: 0 10px; font-size: 12px; }
  .mb-menu:not(.mb-keep) { display: none; }
  .mb-icon.mb-hide-sm { display: none; }
}

/* ═══ REDUCED MOTION ═══ */
@media (prefers-reduced-motion: reduce) {
  #macWindow { transition: none !important; animation: none !important; }
  #macDock { animation: none !important; }
  .dock-item { transition: none !important; transform: none !important; }
  .dock-tip { transition: none !important; }
}

/* Mock window di hero landing — elevation lebih hidup */
.mac-win-body .lp-window {
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16), 0 4px 14px rgba(15, 23, 42, 0.07) !important;
}

/* Hero breathing room di dalam window */
.mac-win-body .lp-hero { padding-top: 48px; }
