/* ✅ Navbar Container */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: #000000;
  width: 100%;
  transition: all 0.4s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ✅ ป้องกัน dropdown และ menu ถูกบัง */
.dropdown-menu,
.dropdown-content {
  z-index: 1000 !important;
}

/* ✅ Navbar Top Section - Logo & Online Status */
.navbar-top {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 40px;
  position: relative;
  min-height: 70px;
}

.nav-logo-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
  z-index: 10;
}

.nav-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ✅ Logo Image */
.logo-image {
  max-width: 150px;
  height: auto;
  object-fit: contain;
  display: block;
  transition: transform 0.3s ease;
  filter: brightness(0) saturate(100%) invert(27%) sepia(100%) saturate(7500%) hue-rotate(0deg) brightness(100%) contrast(118%);
}

/* ✅ ถ้า filter ทำให้ logo หาย ให้ใช้วิธีนี้แทน */
.logo-image[src*="ReloadedMMO.png"] {
  filter: none;
  opacity: 1;
}

.logo-image:hover {
  transform: scale(1.05);
}

@keyframes iridescent {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes glow {
  0% {
    filter: brightness(1) drop-shadow(0 0 10px rgba(255, 0, 255, 0.5));
  }
  100% {
    filter: brightness(1.2) drop-shadow(0 0 30px rgba(0, 255, 255, 0.8));
  }
}

@keyframes drip {
  0%, 100% {
    transform: translateY(3px) scaleY(1.1);
    opacity: 0.7;
  }
  50% {
    transform: translateY(8px) scaleY(1.15);
    opacity: 0.5;
  }
}

/* ✅ Logo Subtitle */
.logo-subtitle {
  font-size: 0.9rem;
  color: #ffffff;
  margin: 0;
  padding: 0;
  font-family: 'Prompt', 'Kanit', sans-serif;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}

/* ✅ Online Indicator - อยู่ใต้ logo */
.online-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffffff;
  font-family: 'Prompt', 'Kanit', sans-serif;
  font-size: 0.85rem;
  margin-top: 4px;
}

.online-dot {
  width: 10px;
  height: 10px;
  background: #00ff00;
  border-radius: 50%;
  box-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

.online-text {
  color: #ffffff;
}

/* ✅ Navbar Bottom Section - Menu */
.navbar-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 40px;
  background: rgba(0, 0, 0, 0.5);
  position: relative;
  border-top: 1px solid rgba(255, 0, 0, 0.1);
  gap: 15px;
  flex-wrap: wrap;
}

/* ✅ Navbar Bottom Bar - Red Bar */
.navbar-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #8B0000;
  z-index: 1;
  box-shadow: 0 -2px 10px rgba(139, 0, 0, 0.5);
}

/* ✅ Menu Links */
.nav-links {
  display: flex;
  gap: 25px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-left {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  margin-right: 0;
}

.nav-right {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-left: 0;
}

.nav-links a,
.nav-left a,
.nav-left .nav-link {
  color: #ffffff;
  text-decoration: none;
  font-family: 'Prompt', 'Kanit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 0;
  position: relative;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-left a:hover,
.nav-left .nav-link:hover {
  color: #ff4444;
}

/* ✅ Active Menu Item */
.nav-links a.active,
.nav-left a.active,
.nav-left .active .nav-link {
  color: #ff0000;
}

.nav-links a.active::after,
.nav-left a.active::after,
.nav-left .active .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #ff0000;
  box-shadow: 0 0 10px #ff0000;
  animation: underlineGlow 2s ease-in-out infinite;
}

@keyframes underlineGlow {
  0%, 100% {
    box-shadow: 0 0 10px #ff0000;
  }
  50% {
    box-shadow: 0 0 20px #ff0000, 0 0 30px #ff0000;
  }
}

/* ✅ Dropdown Parent */
.dropdown-parent {
  position: relative;
  display: inline-block;
}

.dropdown-parent .nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 8px;
  min-width: 180px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  list-style: none;
  padding: 8px 0;
  margin: 0;
  backdrop-filter: blur(10px);
}

.dropdown-parent.show .dropdown-menu {
  display: block;
}

.dropdown-menu li {
  list-style: none;
}

.dropdown-menu li a {
  display: block;
  padding: 10px 16px;
  color: #ffffff;
  text-decoration: none;
  font-family: 'Prompt', 'Kanit', sans-serif;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.dropdown-menu li a:hover {
  background: rgba(255, 0, 0, 0.2);
  color: #ff0000;
}

/* ✅ Wallet Box */
.wallet-box {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  color: #f0f0f0;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: 'Prompt', 'Kanit', sans-serif;
}

.wallet-box span {
  background: rgba(34, 34, 34, 0.8);
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
}

.wallet-box i {
  color: #ff0000;
}

/* ✅ User Dropdown */
.user-dropdown {
  position: relative;
  font-family: 'Prompt', 'Kanit', sans-serif;
}

.user-box-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 0, 0, 0.1);
  border: 2px solid rgba(255, 0, 0, 0.5);
  border-radius: 18px;
  color: #ff0000;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.user-box-btn:hover {
  background: rgba(255, 0, 0, 0.2);
  border-color: #ff0000;
  transform: translateY(-2px);
}

.user-box-btn .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ff0000;
}

.user-box-btn i {
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.user-dropdown.show .user-box-btn i {
  transform: rotate(180deg);
}

.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 8px;
  min-width: 200px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(10px);
  padding: 8px 0;
}

.user-dropdown.show .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #ffffff;
  text-decoration: none;
  font-family: 'Prompt', 'Kanit', sans-serif;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.dropdown-content a:hover {
  background: rgba(255, 0, 0, 0.2);
  color: #ff0000;
}

/* ✅ Online Status (in nav-right) */
.online-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #00ff00;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 6px 12px;
  background: rgba(0, 255, 0, 0.1);
  border-radius: 8px;
  backdrop-filter: blur(5px);
  font-family: 'Prompt', 'Kanit', sans-serif;
}

/* ✅ Mobile Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #ff0000;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.3s ease;
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1001;
}

.mobile-toggle:hover {
  background: rgba(255, 0, 0, 0.1);
  transform: scale(1.1);
}

/* ✅ Merchant Badge */
.merchant-badge-nav {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 5px;
  font-family: 'Prompt', 'Kanit', sans-serif;
}

/* ✅ Responsive - Tablet */
@media screen and (max-width: 1024px) {
  .navbar-top {
    padding: 8px 30px;
    min-height: 60px;
  }
  
  .logo-image {
    max-width: 100px;
  }
  
  .logo-subtitle {
    font-size: 0.75rem;
  }
  
  .navbar-bottom {
    padding: 8px 30px;
    gap: 30px;
  }
  
  .nav-links {
    gap: 18px;
  }
  
  .nav-links a,
  .nav-left a {
    font-size: 0.85rem;
  }
}

/* ✅ Responsive - Mobile */
@media screen and (max-width: 768px) {
  .navbar-top {
    padding: 8px 50px 8px 8px;
    min-height: 60px;
  }
  
  .nav-logo-wrapper {
    width: 100%;
    text-align: center;
  }
  
  .logo-image {
    max-width: 80px;
  }
  
  .logo-subtitle {
    font-size: 0.7rem;
  }
  
  .online-indicator {
    font-size: 0.75rem;
  }
  
  .mobile-toggle {
    display: block;
  }
  
  .navbar-bottom {
    padding: 8px 15px;
    flex-direction: column;
    gap: 12px;
  }
  
  .nav-left {
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    display: none;
  }
  
  .navbar.show-menu .nav-left {
    display: flex;
  }
  
  .nav-right {
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .wallet-box {
    flex-wrap: wrap;
    font-size: 0.85rem;
  }
  
  .user-box-btn {
    width: 100%;
    justify-content: center;
  }
  
  .dropdown-content {
    right: auto;
    left: 0;
    width: 100%;
  }
}

/* ✅ Responsive - Small Mobile */
@media screen and (max-width: 480px) {
  .navbar-top {
    padding: 6px 45px 6px 6px;
    min-height: 50px;
  }
  
  .logo-image {
    max-width: 60px;
  }
  
  .logo-subtitle {
    font-size: 0.65rem;
  }
  
  .online-indicator {
    font-size: 0.7rem;
  }
  
  .navbar-bottom {
    padding: 6px 12px;
  }
  
  .nav-links a,
  .nav-left a {
    font-size: 0.8rem;
  }
  
  .wallet-box {
    font-size: 0.7rem;
    gap: 6px;
  }
  
  .wallet-box span {
    padding: 3px 6px;
  }
}

/* ✅ Scrolled Effect */
.navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.navbar.scrolled .navbar-top {
  padding: 8px 40px;
  min-height: 60px;
}

.navbar.scrolled .logo-image {
  max-width: 100px;
}

/* ✅ Body Padding - ป้องกัน navbar บังเนื้อหา (เพิ่มเยอะมาก) */
body {
  padding-top: 300px !important;
}

/* ✅ Main Content - ขยับลงให้ห่างจาก navbar มากๆ */
main,
#main-container,
.main-content,
.content-wrapper,
.container,
#content,
.content,
.wrapper,
.page-center,
section {
  margin-top: 80px !important;
  padding-top: 80px !important;
}

/* ✅ ลบ margin-top และ padding-top สำหรับหน้า shop.php เท่านั้น */
body:has([href*="shop.php"]) .main-content,
body:has(iframe[src*="shop.php"]) .main-content,
/* ✅ ใช้ path-based selector สำหรับ shop.php */
[data-page="shop"] .main-content,
.shop-page .main-content,
/* ✅ ใช้ URL-based selector */
body[data-url*="shop.php"] .main-content,
/* ✅ Override สำหรับ shop.php โดยตรง */
.shop-page main,
.shop-page #main-container,
.shop-page .main-content,
.shop-page .content-wrapper,
.shop-page .container,
.shop-page #content,
.shop-page .content,
.shop-page .wrapper,
.shop-page .page-center,
.shop-page section {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* ✅ Form และ Form Container - ลบ inline style ที่ถูกตั้งค่าโดย JavaScript */
form {
  position: relative;
  z-index: 1;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* ✅ Modal Form - ไม่ต้องมี margin-top/padding-top */
.auth-modal form,
#loginForm,
#registerForm,
#otpForm {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* ✅ Form Elements - ป้องกันถูกบัง + เพิ่ม margin */
.form-group,
.form-control,
.form-container,
.form-wrapper {
  position: relative;
  z-index: 1;
  margin-top: 20px !important;
  padding-top: 10px !important;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="url"],
input[type="search"],
textarea,
select {
  position: relative;
  z-index: 1;
  margin-top: 15px !important;
  margin-bottom: 15px !important;
}

/* ✅ Card และ Box - ขยับลงเยอะ */
.card,
.box,
.panel,
.content-box {
  margin-top: 50px !important;
  padding-top: 50px !important;
}

/* ✅ Table - ขยับลงเยอะ */
table {
  margin-top: 50px !important;
  margin-bottom: 30px !important;
}

/* ✅ Div และ Container ทั่วไป - ไม่ต้องเพิ่ม margin เพราะใช้ body padding-top แล้ว */

/* ✅ Modal และ Popup ต้องอยู่เหนือ navbar */
.modal,
.popup,
.auth-modal,
.swal2-container {
  z-index: 10000 !important;
}

@media screen and (max-width: 1024px) {
  body {
    padding-top: 280px !important;
  }
  
  main,
  #main-container,
  .main-content,
  .content-wrapper,
  .container,
  #content,
  .content,
  .wrapper,
  .page-center,
  section {
    margin-top: 70px !important;
    padding-top: 70px !important;
  }
  
  form {
    margin-top: 50px !important;
    padding-top: 50px !important;
  }
  
  .card,
  .box,
  .panel,
  .content-box {
    margin-top: 40px !important;
    padding-top: 40px !important;
  }
}

@media screen and (max-width: 768px) {
  body {
    padding-top: 250px !important;
  }
  
  main,
  #main-container,
  .main-content,
  .content-wrapper,
  .container,
  #content,
  .content,
  .wrapper,
  .page-center,
  section {
    margin-top: 60px !important;
    padding-top: 60px !important;
  }
  
  form {
    margin-top: 40px !important;
    padding-top: 40px !important;
  }
  
  .card,
  .box,
  .panel,
  .content-box {
    margin-top: 35px !important;
    padding-top: 35px !important;
  }
}

@media screen and (max-width: 480px) {
  body {
    padding-top: 220px !important;
  }
  
  main,
  #main-container,
  .main-content,
  .content-wrapper,
  .container,
  #content,
  .content,
  .wrapper,
  .page-center,
  section {
    margin-top: 50px !important;
    padding-top: 50px !important;
  }
  
  form {
    margin-top: 35px !important;
    padding-top: 35px !important;
  }
  
  .card,
  .box,
  .panel,
  .content-box {
    margin-top: 30px !important;
    padding-top: 30px !important;
  }
}
