/* ================================================================
   MASRI.CLOUD — NAV COMPONENT (self-contained, no conflicts)
   Replaces: mobile-menu-fix.css + nav rules in style.css/style-fixes.css
   ================================================================ */

/* ── Reset: cancel conflicting nav styles from style.css ── */
.nav__hamburger {
  all: unset;
  box-sizing: border-box;
}

/* ================================================================
   DESKTOP NAV (unchanged from original behaviour)
   ================================================================ */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav.scrolled {
  background: rgba(5, 8, 16, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .nav.scrolled {
  background: rgba(248, 250, 255, 0.88);
}

.nav__inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__logo {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #67e8f9 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  text-decoration: none;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2, #94a3b8);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.nav__link:hover { color: var(--text, #f0f4ff); background: rgba(255,255,255,0.07); }

.nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ================================================================
   HAMBURGER BUTTON — clean, 48×48px touch area
   ================================================================ */

.nav__hamburger {
  /* Reset ALL inherited/conflicting styles */
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  padding: 0;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  z-index: 1001;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.nav__hamburger:active {
  background: rgba(255, 255, 255, 0.12) !important;
}

.nav__hamburger .bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity   0.2s ease;
  pointer-events: none;
}

/* Hamburger → X animation */
.nav__hamburger.is-open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__hamburger.is-open .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav__hamburger.is-open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Show hamburger only on mobile */
@media (max-width: 768px) {
  .nav__hamburger { display: flex; }
  .nav__links     { display: none; }

  /* Perkecil logo agar hamburger tidak terpotong */
  .nav__logo { font-size: 15px; }

  /* Sembunyikan semua kecuali hamburger di mobile */
  .nav__actions .lang-switcher,
  .nav__actions .btn--ghost,
  .nav__actions .btn--primary,
  .nav__actions .theme-toggle { display: none; }

  .nav__inner { padding: 10px 14px; gap: 8px; }
  .nav__actions { gap: 4px; }
}

/* ================================================================
   MOBILE DRAWER — slide from right
   ================================================================ */

/* Wrapper — covers entire viewport when open */
.m-nav {
  position: fixed;
  inset: 0;
  z-index: 2000;
  visibility: hidden;
  pointer-events: none;
}

.m-nav.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* Overlay */
.m-nav__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition:
    background    0.35s ease,
    backdrop-filter 0.35s ease;
  cursor: pointer;
}

.m-nav.is-open .m-nav__overlay {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Drawer panel */
.m-nav__panel {
  position: absolute;
  top: 0; right: 0;
  width: min(82vw, 300px);
  height: 100%;
  background: #080d1a;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Start off-screen */
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  -webkit-overflow-scrolling: touch;
}

.m-nav.is-open .m-nav__panel {
  transform: translateX(0);
}

[data-theme="light"] .m-nav__panel {
  background: #f0f4ff;
  border-left-color: rgba(0, 0, 0, 0.08);
}

/* Panel header */
.m-nav__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

[data-theme="light"] .m-nav__header {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

.m-nav__logo {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 17px;
  font-weight: 800;
  background: linear-gradient(135deg, #67e8f9 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* Close button — 48×48px */
.m-nav__close {
  all: unset;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.m-nav__close:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.92);
}
[data-theme="light"] .m-nav__close {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.5);
}

/* Nav links list */
.m-nav__links {
  display: flex;
  flex-direction: column;
  padding: 12px 12px 4px;
  gap: 2px;
  flex-shrink: 0;
}

/* Each link — 56px tall for comfortable touch */
.m-nav__link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
  /* Stagger-in animation */
  opacity: 0;
  transform: translateX(12px);
}

.m-nav.is-open .m-nav__link {
  opacity: 1;
  transform: translateX(0);
  transition:
    background   0.15s ease,
    color        0.15s ease,
    opacity      0.3s  ease,
    transform    0.3s  cubic-bezier(0.16, 1, 0.3, 1);
}

.m-nav.is-open .m-nav__link:nth-child(1) { transition-delay: 0.05s; }
.m-nav.is-open .m-nav__link:nth-child(2) { transition-delay: 0.09s; }
.m-nav.is-open .m-nav__link:nth-child(3) { transition-delay: 0.13s; }
.m-nav.is-open .m-nav__link:nth-child(4) { transition-delay: 0.17s; }
.m-nav.is-open .m-nav__link:nth-child(5) { transition-delay: 0.21s; }

.m-nav__link:active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

[data-theme="light"] .m-nav__link { color: rgba(0, 0, 0, 0.6); }
[data-theme="light"] .m-nav__link:active { background: rgba(0, 0, 0, 0.05); color: #000; }

/* Link icon pill */
.m-nav__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* Divider */
.m-nav__sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 8px 20px;
  flex-shrink: 0;
}
[data-theme="light"] .m-nav__sep { background: rgba(0,0,0,0.07); }

/* CTA buttons */
.m-nav__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 12px 12px;
  flex-shrink: 0;
}

.m-nav__btn {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body, sans-serif);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.m-nav__btn:active { transform: scale(0.96); opacity: 0.85; }

.m-nav__btn--primary {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.m-nav__btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
}
[data-theme="light"] .m-nav__btn--ghost {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.65);
}

/* Footer: lang + theme */
.m-nav__footer {
  margin-top: auto;
  padding: 16px 20px max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
[data-theme="light"] .m-nav__footer { border-top-color: rgba(0,0,0,0.07); }

.m-nav__langs {
  display: flex;
  gap: 6px;
}

.m-nav__lang {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.m-nav__lang.is-active,
.m-nav__lang:active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}
[data-theme="light"] .m-nav__lang { color: rgba(0,0,0,0.45); border-color: rgba(0,0,0,0.1); }

.m-nav__theme {
  all: unset;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.m-nav__theme:active { background: rgba(255,255,255,0.1); }

/* Body scroll lock */
body.m-nav-open {
  overflow: hidden;
}
