/* Header Styles */

/* Navbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(7, 10, 15, 0.75);
  border-bottom: 1px solid var(--glass-border);
  animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }

  to {
    transform: translateY(0);
  }
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--orange2), var(--orange));
  box-shadow: 0 12px 30px rgba(255, 122, 24, 0.3);
  position: relative;
  overflow: hidden;
}

.logo::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  from {
    left: -150%;
  }

  to {
    left: 150%;
  }
}

.menu {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
}

.chip {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border: none;
  background: transparent;
}

.chip:hover {
  color: var(--txt);
  background: rgba(255, 255, 255, 0.05);
}

.chip.active {
  background: var(--txt) !important;
  color: var(--bg) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Button & Badge Styles (Global) */
.iconbtn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--txt);
  text-decoration: none;
}

.iconbtn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 122, 24, 0.4);
}

.primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-bright));
  border: none;
  box-shadow: 0 16px 40px rgba(255, 122, 24, 0.25);
  color: white;
}

.primary:hover {
  filter: saturate(1.1);
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 122, 24, .18);
  border: 1px solid rgba(255, 122, 24, .35);
  color: var(--orange2);
}

/* Force Mobile Topbar Cart Badge Visibility */
#topbarCartBadge {
  display: flex !important;
}

/* Desktop actions - shown in topbar on desktop */
.actions-desktop {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

/* Floating LINE button - show on all devices (bottom-right) */
.float-line {
  display: flex;
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 56px;
  height: 56px;
  background: #06C755;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  color: white;
  box-shadow: 0 4px 15px rgba(6, 199, 85, 0.4);
  z-index: 10000;
  cursor: pointer;
  transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: floatPulse 2s infinite ease-in-out;
  pointer-events: auto;
}

@keyframes floatPulse {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }

  100% {
    transform: translateY(0);
  }
}

/* Desktop: make LINE button larger and further from screen edge */
@media (min-width: 981px) {
  .float-line {
    right: 70px;
    bottom: 90px;
    width: 70px;
    height: 70px;
  }
}

.float-line:active {
  transform: scale(0.9);
}

/* Mobile Auth Button - hidden by default on desktop */
.iconbtn.actions-mobile-auth {
  display: none !important;
  visibility: hidden !important;
}

.nav-actions-mobile {
  display: none;
}

/* Mobile Navigation Bar - hidden on desktop */
.mobile-nav {
  display: none;
}

/* FAB nav (mobile) - hidden by default */
.fab-nav-button,
.fab-nav-backdrop,
.fab-nav-menu {
  display: none;
}

/* Mobile Responsive Overrides */
@media (max-width: 980px) {
  .topbar {
    padding: 10px 0;
    animation: none;
    transform: none !important;
  }

  .nav {
    flex-direction: row;
    justify-content: space-between;
    padding: 0;
  }

  .menu {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 280px;
    background: rgba(11, 18, 38, 0.95);
    flex-direction: column;
    padding: 80px 20px;
    transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 0;
    border: none;
    border-left: 1px solid var(--glass-border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    overflow-y: auto;
    gap: 10px;
  }

  .menu.active {
    right: 0;
  }

  .chip {
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 12px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    color: var(--muted);
  }

  .chip:hover,
  .chip:active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--txt);
  }

  .chip.active {
    background: linear-gradient(135deg, var(--orange2), var(--orange)) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(255, 122, 24, 0.3);
    font-weight: 600;
  }

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

  /* Show mobile auth button */
  .nav-actions-mobile {
    display: flex !important;
    gap: 8px;
    align-items: center;
  }

  .iconbtn.actions-mobile-auth {
    display: flex !important;
    visibility: visible !important;
    gap: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #000 !important;
    /* Black background as requested */
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--txt);
    position: relative;
  }

  /* Specific fix for login button content */
  #btnAuthMobile svg {
    margin: 0;
  }

  .actions-mobile-auth svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block !important;
  }

  .actions-mobile-auth span:not(.badge) {
    display: none !important;
  }

  .actions-mobile-auth {
    /* Overruled by above block, keeping for safety but resetting */
    padding: 0 !important;
    min-width: 38px !important;
  }

  /* Badge positioning for mobile topbar */
  .actions-mobile-auth .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    background: var(--danger);
    color: white;
    border-radius: 9px;
    border: 2px solid #070A0F;
    /* Matches bg to create cutout effect */
    display: flex;
    /* Will be toggled by JS but needs flex when shown */
    align-items: center;
    justify-content: center;
    z-index: 10;
  }

  .float-line {
    display: flex !important;
    position: fixed;
    right: 20px;
    bottom: 85px;
    width: 56px;
    height: 56px;
  }

  /* Hide old bottom navigation bar on mobile (replaced by FAB) */
  .mobile-nav {
    display: none !important;
  }

  /* FAB nav button */
  .fab-nav-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 20px !important;
    bottom: 20px !important;
    left: auto !important;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, var(--orange), var(--orange-bright));
    color: #fff;
    box-shadow: 0 12px 30px rgba(255, 122, 24, 0.35);
    z-index: 10002;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .fab-nav-button:active {
    transform: scale(0.96);
  }

  .fab-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10001;
  }

  .fab-nav-menu {
    display: none;
    position: fixed;
    right: 20px !important;
    bottom: 90px !important;
    left: auto !important;
    width: 260px;
    max-width: calc(100vw - 40px);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10002;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(11, 18, 38, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
    padding: 10px;
    /* Custom scrollbar for premium look */
    scrollbar-width: thin;
    scrollbar-color: var(--orange2) transparent;
  }

  .fab-nav-menu::-webkit-scrollbar {
    width: 4px;
  }

  .fab-nav-menu::-webkit-scrollbar-thumb {
    background: var(--orange2);
    border-radius: 10px;
  }

  .fab-nav-menu.open {
    display: block;
  }

  .fab-nav-backdrop.open {
    display: block;
  }

  .fab-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: var(--txt);
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
  }

  .fab-nav-item+.fab-nav-item {
    margin-top: 8px;
  }

  .fab-nav-item:active,
  .fab-nav-item.active {
    background: rgba(255, 122, 24, 0.12);
    border-color: rgba(255, 122, 24, 0.35);
    color: var(--orange2);
  }

  .fab-nav-item.active svg {
    color: var(--orange);
  }

  .fab-nav-item svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--orange2);
  }

  .fab-nav-item.cart .badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
  }
}

/* Toast Notification */
/* Toast Notification */
.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.95), rgba(234, 88, 12, 0.95));
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(249, 115, 22, 0.4);
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 20000;
  font-weight: 600;
  font-size: 15px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  max-width: 350px;
  min-width: 250px;
  text-align: center;
  visibility: hidden;
  /* Changed from visible in toast.css to hidden to avoid empty box */
}

.toast.show {
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
}

/* Success variant - Green */
.toast.success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Error variant - Red */
.toast.error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Warning variant - Yellow */
.toast.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.95));
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.4);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Mobile positioning */
@media (max-width: 980px) {
  .toast {
    top: auto;
    bottom: 80px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100px);
    max-width: calc(100vw - 40px);
  }

  .toast.show {
    transform: translateX(-50%) translateY(0);
  }
}

/* Auth Visibility Helpers */
html.logged-in [data-tab="login"],
html.logged-in [data-tab="register"],
body.logged-in [data-tab="login"],
body.logged-in [data-tab="register"] {
  display: none !important;
}

html:not(.logged-in) [data-tab="history"],
body:not(.logged-in) [data-tab="history"] {
  display: none !important;
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
  will-change: opacity, transform;
  /* optimize performance */
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}


/* Overlay & Modal Unified Styles */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Hidden state for overlays */
.overlay.hidden {
  display: none !important;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative;
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modalHeader b {
  font-size: 20px;
}

.close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--txt);
  cursor: pointer;
  font-size: 13px;
}

.modalBody {
  max-height: calc(85vh - 100px);
  overflow-y: auto;
}

.sep {
  height: 1px;
  background: var(--glass-border);
  margin: 15px 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--muted);
}

.input,
.field input,
.field textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--txt);
  outline: none;
  font-family: inherit;
  transition: 0.3s;
}

.input:focus,
.field input:focus {
  border-color: var(--orange2);
  background: rgba(255, 122, 24, 0.05);
}

.or-divider {
  text-align: center;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
  position: relative;
}

.or-divider::before,
.or-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--glass-border);
}

.or-divider::before {
  left: 0;
}

.or-divider::after {
  right: 0;
}

.btn-line {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #06C755;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--glass-border);
}

.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  transition: 0.3s;
}

.tab:hover {
  color: var(--txt);
  background: rgba(255, 255, 255, 0.02);
}

.tab.active {
  background: linear-gradient(135deg, var(--orange), var(--orange-bright));
  color: white;
  box-shadow: 0 4px 15px rgba(255, 122, 24, 0.2);
}

.btn-line:hover {
  background: #05b34c !important;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(6, 199, 85, 0.3);
}

.line-icon-img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: contain;
}

/* Ensure modal buttons are full-width */
.modalBody form .iconbtn.primary {
  width: 100%;
  justify-content: center;
}