@import url("dark-theme.css");

/* Base styles */
body {
  font-family: 'Vazirmatn', serif;
  background-color: #f9fafb;
  color: #111827;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Nav dropdown */
.nav-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  width: 12rem;
  border-radius: 0.5rem;
  background-color: #fff;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  border: 1px solid rgb(0 0 0 / 0.05);
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 50;
}

/* Mega nav button (shared) */
.mega-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: none;
}
.mega-nav-btn:hover {
  color: #2563eb;
  background-color: rgba(59, 130, 246, 0.06);
}
.mega-nav-btn-highlight {
  color: #7c3aed;
}
.mega-nav-btn-highlight:hover {
  color: #6d28d9;
  background-color: rgba(124, 58, 237, 0.06);
}

/* Nav text labels */
.mega-nav-labels {
  display: flex;
  align-items: center;
  gap: 0;
}
.mega-nav-label {
  display: inline-flex;
  align-items: center;
  position: relative;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.mega-nav-label:hover {
  color: #2563eb;
  background-color: rgba(59, 130, 246, 0.06);
}
.mega-nav-label::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0.75rem;
  left: 0.75rem;
  height: 2px;
  background: #2563eb;
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.mega-nav-label:hover::after,
.mega-nav-trigger:hover .mega-nav-label:hover::after {
  transform: scaleX(1);
}

/* Mega nav trigger — label + caret rendered as siblings (not nested, since
   a <button> can't legally live inside an <a>). The caret is the touch/
   keyboard affordance; hover keeps working for mouse users via CSS. */
.mega-nav-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.mega-nav-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-inline-start: -0.25rem;
  padding: 0;
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 9999px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease;
}
.mega-nav-trigger:hover .mega-nav-caret,
.mega-nav-trigger.open .mega-nav-caret {
  color: #2563eb;
}
.mega-nav-trigger:hover .mega-nav-caret i,
.mega-nav-trigger.open .mega-nav-caret i {
  transform: rotate(180deg);
}
.mega-nav-caret i {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.7rem;
}

/* Mega nav panel — dropdown, opened by mouse hover, keyboard focus (tabbing
   into its links), or a click/tap on the caret (.open class, toggled by JS) */
.mega-nav-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0;
  padding-top: 12px;
  z-index: 50;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s;
}
.mega-nav-trigger:hover > .mega-nav-panel,
.mega-nav-trigger:focus-within > .mega-nav-panel,
.mega-nav-trigger.open > .mega-nav-panel,
.mega-nav-panel:hover {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
/* Horizontal layout on desktop: sections lay out as side-by-side columns
   instead of stacking, using the extra width desktop has available
   (wraps to a second row only if a group ever gets more columns than fit). */
.mega-nav-panel-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  width: max-content;
  max-width: min(1080px, calc(100vw - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 0 0 1px rgb(0 0 0 / 0.05);
  padding: 0.5rem;
}
.mega-nav-section {
  flex: 0 0 235px;
  width: 235px;
  padding-inline-end: 0.5rem;
}
.mega-nav-section + .mega-nav-section {
  border-inline-start: 1px solid #f3f4f6;
  padding-inline-start: 0.5rem;
  margin-top: 0;
}
.mega-nav-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem 0.3rem;
  font-size: 0.9375rem;
  font-weight: 800;
  color: #475569;
  letter-spacing: 0.01em;
}
.mega-nav-section-title i {
  font-size: 1rem;
}
/* Product-type sub-grouping within a major (student-track) section */
.mega-nav-subgroup-title {
  padding: 0.375rem 0.625rem 0.125rem calc(0.625rem + 0.75rem);
  font-size: 0.8125rem;
  font-weight: 700;
  color: #334155;
}
.mega-cat-item-indented {
  padding-inline-start: calc(0.625rem + 0.75rem);
}
.mobile-dropdown-subgroup-title {
  padding: 0.375rem 1.5rem 0.125rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
}
.mobile-dropdown-item-indented {
  padding-inline-start: 1.5rem;
}

.mega-extra-badge {
  display: inline-block;
  font-size: 0.5rem;
  font-weight: 600;
  color: #a16207;
  background: #fefce8;
  padding: 0.0625rem 0.25rem;
  border-radius: 9999px;
  margin-inline-start: 0.25rem;
  vertical-align: middle;
}
.mega-chevron {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.mega-nav-trigger:hover .mega-chevron {
  transform: rotate(180deg);
}

/* Active nav item state */
.mega-nav-label.active,
.mega-nav-btn.active {
  color: #2563eb;
  background-color: rgba(59, 130, 246, 0.08);
}
.mega-nav-label.active::after {
  transform: scaleX(1);
}

/* Promo section — subtle */
.mega-promo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}
.mega-promo-content {
  flex: 1;
}
.mega-promo-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}
.mega-promo-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}
.mega-promo-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.625rem;
}
.mega-promo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563eb;
  padding: 0.375rem 0.75rem;
  background: #eff6ff;
  border-radius: 0.375rem;
  transition: background 0.2s ease;
}
.mega-promo-link:hover {
  background: #dbeafe;
}
.mega-promo-icon {
  opacity: 0.08;
  color: #2563eb;
  margin-left: 1rem;
}

/* Mega cat items (dropdown list) */
.mega-cat-items {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mega-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  color: #475569;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  text-decoration: none;
}
.mega-cat-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.mega-free-badge {
  font-size: 0.5rem;
  font-weight: 600;
  color: #16a34a;
  background: #f0fdf4;
  padding: 0.0625rem 0.25rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* Bottom link in dropdown */
.mega-bottom-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  border-top: 1px solid #f3f4f6;
  margin-top: 0.25rem;
  padding-top: 0.625rem;
  border-radius: 0;
  transition: color 0.15s ease;
  text-decoration: none;
}
.mega-bottom-link:hover {
  color: #2563eb;
}


/* Header shrink-on-scroll */
#topnav {
  transition: background-color 0.2s ease;
}
#topnav #topnavRow {
  transition: height 0.2s ease;
}
#topnav.scrolled #topnavRow {
  height: 3.5rem !important;
}
#topnav.scrolled #navLogo {
  height: 2rem !important;
}
#navLogo {
  transition: height 0.2s ease;
}

/* Search trigger + overlay */
.nav-search-panel {
  position: fixed;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(32rem, calc(100% - 2rem));
  max-height: min(28rem, calc(100vh - 7rem));
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  z-index: 70;
  overflow: hidden;
  display: none;
  flex-direction: column;
}
/* :not(.hidden) beats Tailwind's .hidden{display:none} on specificity
   (0,2,0 > 0,1,0) regardless of stylesheet load order, so the panel stays
   hidden until JS removes the `hidden` class — see the bottom-tab-bar
   comment above for why an unconditional `display` here would be unsafe. */
.nav-search-panel:not(.hidden) {
  display: flex;
}
.nav-search-panel-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.nav-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.nav-search-input-wrap i.bi-search {
  color: #94a3b8;
}
#navSearchInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9375rem;
  background: transparent;
  color: #111827;
}
#navSearchClose {
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 9999px;
}
#navSearchClose:hover {
  background: #f3f4f6;
  color: #4b5563;
}
.nav-search-results {
  overflow-y: auto;
  padding: 0.5rem;
}
.nav-search-hint,
.nav-search-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: #9ca3af;
}
.nav-search-section-title {
  padding: 0.5rem 0.625rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.nav-search-result-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem;
  font-size: 0.8125rem;
  color: #374151;
  border-radius: 0.5rem;
  text-decoration: none;
}
.nav-search-result-item:hover {
  background-color: #f1f5f9;
}
.nav-search-result-item i {
  color: #94a3b8;
  flex-shrink: 0;
}

/* Mobile bottom tab bar — display is controlled entirely by our own media
   query (not Tailwind's `lg:hidden` class) because custom.css loads after
   tailwind.min.css: an unconditional `display:flex` here would win the
   cascade over `.lg\:hidden{display:none}` at the same specificity and
   defeat the responsive hide on desktop. */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 50;
  display: none;
  align-items: stretch;
  height: 3.75rem;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid #f1f5f9;
  box-shadow: 0 -4px 12px rgb(0 0 0 / 0.04);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (max-width: 1023px) {
  .bottom-tab-bar {
    display: flex;
  }
}
.bottom-tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
}
.bottom-tab-icon {
  position: relative;
  font-size: 1.125rem;
  line-height: 1;
}
.bottom-tab-item.active {
  color: #2563eb;
}
.bottom-tab-dot {
  position: absolute;
  top: -0.125rem;
  left: -0.375rem;
  width: 0.5rem;
  height: 0.5rem;
  background-color: #ef4444;
  border-radius: 9999px;
  border: 2px solid #fff;
}
@media (max-width: 1023px) {
  body {
    padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0));
  }
  .back-to-top {
    bottom: calc(3.75rem + 1rem);
  }
}

.mobile-dropdown-section-title {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Mobile menu */
.mobile-menu {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 18rem;
  background-color: #fff;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.3s;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.mobile-menu.show {
  transform: translateX(0);
}
.mobile-menu .mobile-menu-header {
  flex-shrink: 0 !important;
}
.mobile-menu .mobile-menu-scroll {
  flex: 1 !important;
  overflow-y: auto !important;
  min-height: 0 !important;
  -webkit-overflow-scrolling: touch;
}
/* Override the mobile menu to be hidden on desktop */
@media (min-width: 1024px) {
    #mobileMenu.mobile-menu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transform: none !important;
        right: -9999px !important;
    }
}

/* Make sure mobile menu is visible on mobile but hidden by default */
@media (max-width: 1023px) {
    #mobileMenu.mobile-menu {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: translateX(100%);
        right: 0 !important;
    }
    
    #mobileMenu.mobile-menu.show {
        transform: translateX(0) !important;
    }
}
/* Glass card */
.glass-card {
  border-radius: 1rem;
  background-color: rgb(255 255 255 / 0.7);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Primary button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background-color: #2c5bb8;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background-color: #244895;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(44 91 184 / 0.3);
}
.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3d74d4;
}
.btn-primary:active {
  transform: translateY(0);
}

/* Outline button */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 1px solid #2c5bb8;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #2c5bb8;
  transition: all 0.2s ease;
}
.btn-outline:hover {
  background-color: #f0f5ff;
  transform: translateY(-1px);
}
.btn-outline:focus {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3d74d4;
}
.btn-outline:active {
  transform: translateY(0);
}

/* Input field */
.input-field {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background-color: #fff;
  padding: 0.75rem 1rem;
  line-height: 1.5;
  font-size: 0.875rem;
  color: #111827;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.input-field::placeholder {
  color: #9ca3af;
}
.input-field:focus {
  border-color: #3d74d4;
  outline: none;
  box-shadow: 0 0 0 3px rgb(61 116 212 / 0.15);
}

/* Notification enter animation */
.notification-enter {
  animation: notificationSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes notificationSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Modern select */
.modern-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1.5px solid #d1d5db;
  background-color: #f9fafb;
  font-weight: 600;
  font-size: 0.875rem;
  color: #1f2937;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.5;
  width: 100%;
}
.modern-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background-color: #fff;
}

/* Text balance */
.text-balance {
  text-wrap: balance;
}

/* Admin panel mobile */
@media (max-width: 1023px) {
  .admin-topbar {
    padding-left: 3.5rem;
  }
}

/* Spin animation for loading states */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 1s linear infinite;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: #2c5bb8;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(44, 91, 184, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 40;
  cursor: pointer;
  border: none;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: #244895;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(44, 91, 184, 0.4);
}
