/* ============================================
   BOCHI CILACAP - NAVBAR MOBILE STYLES FIX
   File: navbar-mobile-styles.css
   ============================================ */

/* ========================================
   DESKTOP NAVBAR - Improved Colors
   ======================================== */
@media (min-width: 992px) {
  nav.desktop-nav ul.first-level > li > a {
    color: #2c3e50 !important;
    font-weight: 600;
    transition: all 0.3s ease;
  }

  nav.desktop-nav ul.first-level > li > a:hover {
    color: #27ae60 !important;
  }

  nav.desktop-nav ul.first-level > li > a:after {
    background-color: #27ae60 !important;
  }

  /* ACTIVE STATE - Desktop */
  nav.desktop-nav ul.first-level > li.active > a,
  nav.desktop-nav ul.first-level > li > a.active {
    color: #27ae60 !important;
    font-weight: 700;
  }

  nav.desktop-nav ul.first-level > li.active > a:after,
  nav.desktop-nav ul.first-level > li > a.active:after {
    width: 50%;
    opacity: 1;
    top: 35px;
  }

  /* Hide mobile menu on desktop */
  nav.mobile-nav {
    display: none !important;
  }

  .menu-icon {
    display: none !important;
  }
}

/* ========================================
   MOBILE & TABLET (991px and below)
   ======================================== */
@media (max-width: 991px) {
  /* Hide desktop nav on mobile */
  nav.desktop-nav {
    display: none !important;
  }

  /* Header adjustments */
  header.main-header {
    height: 70px;
    position: fixed;
    background: #ffffff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    z-index: 9999;
  }

  header.main-header .logo {
    height: 70px;
    line-height: 70px;
  }

  header.main-header .logo img {
    max-height: 45px !important;
  }

  /* ========================================
     HAMBURGER ICON - ALTERNATIF DENGAN !IMPORTANT
     ======================================== */
  .menu-icon {
    display: block !important;
    float: right;
    width: 30px;
    height: 24px;
    margin-top: 23px;
    cursor: pointer;
    position: relative;
    z-index: 10001;
    padding: 0;
    background: transparent;
    border: none;
    -webkit-tap-highlight-color: transparent;
  }

  .menu-icon .line {
    display: block !important;
    height: 3px !important;
    width: 100% !important;
    background: #2c3e50 !important;
    border-radius: 2px;
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    margin: 0 !important;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center center;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* 3 Garis dengan jarak yang lebih jelas - PASTI TAMPAK */
  .menu-icon .line1 {
    top: 0 !important;
  }

  .menu-icon .line2 {
    top: 10.5px !important; /* Tengah persis */
  }

  .menu-icon .line3 {
    top: 21px !important; /* Bawah */
  }

  /* NO HOVER - Keep it clean and simple */

  /* Hamburger ACTIVE (X) - PERFECT SYMMETRY */
  .menu-icon.active .line {
    background: #e74c3c !important;
  }

  .menu-icon.active .line1 {
    top: 10.5px !important;
    transform: rotate(45deg);
  }

  .menu-icon.active .line2 {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0);
  }

  .menu-icon.active .line3 {
    top: 10.5px !important;
    transform: rotate(-45deg);
  }

  /* NO HOVER for active state - Keep red */

  /* ========================================
     MOBILE NAVIGATION - PERFECT HOVER
     ======================================== */
  nav.mobile-nav {
    display: block;
    position: fixed;
    top: 70px;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 70px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 9998;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    -webkit-overflow-scrolling: touch;
    /* FORCE HIDDEN by default */
    visibility: hidden;
    opacity: 0;
  }

  nav.mobile-nav.active {
    transform: translateX(0);
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Mobile Navigation Menu Items */
  nav.mobile-nav > ul.first-level {
    list-style: none;
    margin: 0;
    padding: 40px 0;
    width: 100%;
  }

  nav.mobile-nav > ul.first-level > li {
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.3s ease;
    position: relative;
  }

  /* Stagger animation for menu items */
  nav.mobile-nav.active > ul.first-level > li:nth-child(1) {
    animation: slideInRight 0.4s ease forwards 0.1s;
  }

  nav.mobile-nav.active > ul.first-level > li:nth-child(2) {
    animation: slideInRight 0.4s ease forwards 0.2s;
  }

  nav.mobile-nav.active > ul.first-level > li:nth-child(3) {
    animation: slideInRight 0.4s ease forwards 0.3s;
  }

  nav.mobile-nav.active > ul.first-level > li:nth-child(4) {
    animation: slideInRight 0.4s ease forwards 0.4s;
  }

  @keyframes slideInRight {
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* Menu Link - HOVER BACKGROUND PERFECTLY ALIGNED WITH TEXT */
  nav.mobile-nav > ul.first-level > li > a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 60px;
    padding: 15px 30px;
    color: #ffffff;
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    text-align: left;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
  }

  /* Left border indicator */
  nav.mobile-nav > ul.first-level > li > a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: #ffffff;
    transition: width 0.3s ease;
    border-radius: 0 3px 3px 0;
  }

  /* Background overlay for hover - PERFECTLY ALIGNED */
  nav.mobile-nav > ul.first-level > li > a::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s ease;
    z-index: -1;
  }

  /* HOVER - Background terang + border kiri + text tetap center */
  nav.mobile-nav > ul.first-level > li > a:hover::after,
  nav.mobile-nav > ul.first-level > li > a:active::after {
    background: rgba(255, 255, 255, 0.15);
  }

  nav.mobile-nav > ul.first-level > li > a:hover::before,
  nav.mobile-nav > ul.first-level > li > a:active::before {
    width: 5px;
  }

  nav.mobile-nav > ul.first-level > li > a:hover,
  nav.mobile-nav > ul.first-level > li > a:active {
    color: #ffffff;
    padding-left: 35px; /* Slight indent when hover */
  }

  /* Active tap feedback */
  nav.mobile-nav > ul.first-level > li > a:active::after {
    background: rgba(255, 255, 255, 0.25);
    transition: background 0.1s ease;
  }

  /* ACTIVE STATE - Mobile */
  nav.mobile-nav > ul.first-level > li.active > a,
  nav.mobile-nav > ul.first-level > li > a.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 800;
    padding-left: 35px;
  }

  nav.mobile-nav > ul.first-level > li.active > a::before,
  nav.mobile-nav > ul.first-level > li > a.active::before {
    width: 5px;
    background: #ffd700;
  }

  nav.mobile-nav > ul.first-level > li.active > a::after,
  nav.mobile-nav > ul.first-level > li > a.active::after {
    background: rgba(255, 255, 255, 0.2);
  }

  nav.mobile-nav > ul.first-level > li:last-child {
    border-bottom: none;
  }

  /* Add spacing for body content */
  body {
    padding-top: 70px;
  }

  /* REMOVED ALL HOVER EFFECTS FOR HAMBURGER ICON */
  /* Touch-only interaction - no hover confusion */
}

/* ========================================
   TABLET SPECIFIC (768px - 991px)
   ======================================== */
@media (min-width: 768px) and (max-width: 991px) {
  nav.mobile-nav {
    max-width: 400px;
  }

  nav.mobile-nav > ul.first-level > li > a {
    font-size: 15px;
    padding: 14px 30px;
    min-height: 56px;
  }

  nav.mobile-nav > ul.first-level > li > a:hover {
    padding-left: 35px;
  }
}

/* ========================================
   MOBILE SPECIFIC (480px and below)
   ======================================== */
@media (max-width: 480px) {
  header.main-header {
    height: 65px;
  }

  header.main-header .logo {
    height: 65px;
    line-height: 65px;
  }

  header.main-header .logo img {
    max-height: 40px !important;
  }

  /* Hamburger icon - Mobile size dengan !important */
  .menu-icon {
    width: 28px;
    height: 22px;
    margin-top: 21.5px;
  }

  .menu-icon .line {
    height: 3px !important;
  }

  .menu-icon .line1 {
    top: 0 !important;
  }

  .menu-icon .line2 {
    top: 9.5px !important;
  }

  .menu-icon .line3 {
    top: 19px !important;
  }

  .menu-icon.active .line1,
  .menu-icon.active .line3 {
    top: 9.5px !important;
  }

  nav.mobile-nav {
    top: 65px;
    height: calc(100vh - 65px);
    /* FORCE HIDDEN by default */
    visibility: hidden;
    opacity: 0;
  }

  nav.mobile-nav.active {
    visibility: visible !important;
    opacity: 1 !important;
  }

  nav.mobile-nav > ul.first-level {
    padding: 30px 0;
  }

  nav.mobile-nav > ul.first-level > li > a {
    font-size: 14px;
    padding: 12px 25px;
    min-height: 52px;
  }

  nav.mobile-nav > ul.first-level > li > a:hover {
    padding-left: 30px;
  }

  body {
    padding-top: 65px;
  }
}

/* Extra small mobile (360px and below) */
@media (max-width: 360px) {
  .menu-icon {
    width: 26px;
    height: 20px;
    margin-top: 22.5px;
  }

  .menu-icon .line {
    height: 2.5px !important;
  }

  .menu-icon .line1 {
    top: 0 !important;
  }

  .menu-icon .line2 {
    top: 8.75px !important;
  }

  .menu-icon .line3 {
    top: 17.5px !important;
  }

  .menu-icon.active .line1,
  .menu-icon.active .line3 {
    top: 8.75px !important;
  }

  nav.mobile-nav > ul.first-level > li > a {
    font-size: 13px;
    padding: 10px 20px;
    min-height: 48px;
  }

  nav.mobile-nav > ul.first-level > li > a:hover {
    padding-left: 25px;
  }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */
body.dark-mode header.main-header {
  background: rgba(30, 30, 30, 0.98);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
}

body.dark-mode .menu-icon .line {
  background: #e0e0e0;
}

body.dark-mode .menu-icon:hover .line {
  background: #27ae60;
}

body.dark-mode .menu-icon.active .line {
  background: #e74c3c;
}

body.dark-mode .menu-icon.active:hover .line {
  background: #c0392b;
}

body.dark-mode nav.mobile-nav {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

body.dark-mode nav.mobile-nav > ul.first-level > li {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode nav.mobile-nav > ul.first-level > li > a:hover::after,
body.dark-mode nav.mobile-nav > ul.first-level > li > a:active::after {
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode nav.mobile-nav > ul.first-level > li > a:active::after {
  background: rgba(255, 255, 255, 0.15);
}

/* Desktop Dark Mode */
@media (min-width: 992px) {
  body.dark-mode nav.desktop-nav ul.first-level > li > a {
    color: #e0e0e0 !important;
  }

  body.dark-mode nav.desktop-nav ul.first-level > li > a:hover {
    color: #27ae60 !important;
  }

  /* Active state dark mode - desktop */
  body.dark-mode nav.desktop-nav ul.first-level > li.active > a,
  body.dark-mode nav.desktop-nav ul.first-level > li > a.active {
    color: #27ae60 !important;
  }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */
* {
  -webkit-tap-highlight-color: transparent;
}

nav.mobile-nav * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Smooth scrolling for mobile menu */
nav.mobile-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

nav.mobile-nav::-webkit-scrollbar {
  width: 6px;
}

nav.mobile-nav::-webkit-scrollbar-track {
  background: transparent;
}

nav.mobile-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

nav.mobile-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Prevent text selection on tap */
.menu-icon,
nav.mobile-nav a {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Hardware acceleration for smooth animations */
.menu-icon,
.menu-icon .line,
nav.mobile-nav {
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000px;
  perspective: 1000px;
}
