/*
 * BESTVOIPTEL - UI Components
 * Layout, Header, Navigation, Footer, and Widget Styles
 */

/* 1. Header & Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: all var(--transition-normal);
  border-bottom: 1px solid transparent;
}

.site-header.transparent {
  background-color: transparent;
}

.site-header.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  height: 70px;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  max-width: 1400px !important;
  padding-left: 24px !important;
  padding-right: 24px !important;
  flex-wrap: nowrap !important;
}

/* Brand Logo */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  z-index: 1001;
}

.brand-logo svg {
  color: var(--primary);
  transition: transform var(--transition-normal);
}

.brand-logo:hover svg {
  transform: rotate(15deg) scale(1.1);
}

.brand-logo span {
  background: linear-gradient(135deg, var(--text-primary) 50%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Image-based Logos */
.brand-logo .logo-img {
  height: 46px;
  width: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.brand-logo .logo-light {
  display: none;
}

.brand-logo .logo-dark {
  display: block;
}

[data-theme="dark"] .brand-logo .logo-light {
  display: block;
}

[data-theme="dark"] .brand-logo .logo-dark {
  display: none;
}

/* Footer always-dark logo */
.brand-logo .logo-dark-always {
  display: block !important;
}

/* Desktop dropdown chevron rotation */
.nav-item.dropdown:hover .chevron-icon {
  transform: rotate(180deg);
}

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

/* Logo and navigation visibility overrides for headers with dark heroes (non-index pages) */
.site-header.has-dark-hero .brand-logo .logo-light {
  display: block !important;
}
.site-header.has-dark-hero .brand-logo .logo-dark {
  display: none !important;
}
.site-header.has-dark-hero.scrolled .brand-logo .logo-light {
  display: none !important;
}
.site-header.has-dark-hero.scrolled .brand-logo .logo-dark {
  display: block !important;
}
[data-theme="dark"] .site-header.has-dark-hero.scrolled .brand-logo .logo-light {
  display: block !important;
}
[data-theme="dark"] .site-header.has-dark-hero.scrolled .brand-logo .logo-dark {
  display: none !important;
}
.site-header.has-dark-hero .nav-link {
  color: rgba(255, 255, 255, 0.85) !important;
}
.site-header.has-dark-hero .nav-link:hover {
  color: var(--primary) !important;
}
.site-header.has-dark-hero .theme-switch {
  color: rgba(255, 255, 255, 0.85) !important;
}
.site-header.has-dark-hero .theme-switch:hover {
  color: var(--primary) !important;
}
.site-header.has-dark-hero .btn-secondary {
  color: #FFFFFF !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}
.site-header.has-dark-hero .btn-secondary:hover {
  color: #FFFFFF !important;
  border-color: #FFFFFF !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}
.site-header.has-dark-hero .menu-toggle span {
  background-color: #FFFFFF !important;
}
.site-header.has-dark-hero.scrolled {
  background: rgba(8, 14, 26, 0.85) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Nav Menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  flex-wrap: nowrap !important;
}

@media screen and (max-width: 1400px) {
  .nav-menu {
    gap: 12px;
  }
}

/* Navigation link gaps and sizes on various laptop screen sizes to prevent wrapping */
@media screen and (max-width: 1360px) {
  .nav-menu {
    gap: 10px !important;
  }
  .nav-link {
    font-size: 0.86rem !important;
  }
}

@media screen and (max-width: 1260px) {
  .nav-menu {
    gap: 8px !important;
  }
  .nav-link {
    font-size: 0.82rem !important;
  }
}

.nav-item {
  /* No position: relative to allow nested mega-menu to position itself relative to the .site-header */
}

.nav-link {
  position: relative;
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap !important; /* Ensure menu text never breaks into two lines */
}

.chevron-icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.5px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

@media screen and (max-width: 1400px) {
  .nav-link {
    font-size: 0.88rem;
  }
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-accent);
  transition: width var(--transition-normal);
}

.nav-link:hover::after,
.nav-item.active .nav-link::after {
  width: 100%;
}

/* Mega Menu */
.mega-menu {
  display: none !important; /* Fully disabled and unrendered by default to protect unhovered layouts */
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  width: 95vw;
  max-width: 900px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--border-radius);
  padding: 32px;
  grid-template-columns: repeat(3, 1fr) 220px;
  gap: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1000;
}

.mega-menu::before {
  content: '';
  position: absolute;
  top: -30px; /* Invisible hover bridge spanning the gap to the header link */
  left: 0;
  width: 100%;
  height: 30px;
  background-color: transparent;
}

@keyframes megaMenuFadeIn {
  0% {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(15px);
  }
  100% {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}

/* Hover triggers ONLY on desktop resolutions */
@media screen and (min-width: 1201px) {
  .nav-item:hover .mega-menu {
    display: grid !important;
    animation: megaMenuFadeIn 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: auto;
  }
}

.mega-menu-col-title {
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.mega-menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mega-menu-item a {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-menu-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.mega-menu-item-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.mega-menu-item:hover .mega-menu-item-title {
  color: var(--primary);
}

.mega-menu-promo {
  background: var(--gradient-primary);
  border-radius: 12px;
  padding: 24px;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mega-menu-promo h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.mega-menu-promo p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  margin-bottom: 16px;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

@media screen and (max-width: 1360px) {
  .header-actions {
    gap: 10px;
  }
  #btn-sales {
    display: none !important;
  }
}

/* Theme Switcher */
.theme-switch {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.theme-switch:hover {
  background-color: var(--border-color);
  color: var(--primary);
}

.theme-switch .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-switch .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-switch .moon-icon {
  display: none;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1002;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 4px;
  transition: all var(--transition-normal);
}

/* Mobile menu open transform */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* 2. Fullscreen Search Popup */
.search-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 18, 29, 0.95);
  backdrop-filter: blur(15px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-popup.active {
  opacity: 1;
  visibility: visible;
}

.search-popup-close {
  position: absolute;
  top: 40px;
  right: 40px;
  background: none;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  font-size: 2rem;
  transition: transform var(--transition-fast);
}

.search-popup-close:hover {
  transform: rotate(90deg);
}

.search-form-container {
  width: 90%;
  max-width: 600px;
  text-align: center;
}

.search-form-container h3 {
  color: #FFFFFF;
  margin-bottom: 24px;
}

.search-input-group {
  position: relative;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 12px;
}

.search-input-group input {
  width: 100%;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 1.5rem;
  outline: none;
  font-family: var(--font-secondary);
}

.search-input-group button {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 1.5rem;
}

/* 3. Footer */
.site-footer {
  background-color: #040A12;
  color: #94A3B8;
  padding: 100px 0 40px 0;
  font-family: var(--font-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-top {
  display: grid;
  grid-template-columns: 350px repeat(3, 1fr);
  gap: 48px;
  margin-bottom: 64px;
}

.footer-brand-col p {
  color: #64748B;
  margin: 20px 0 24px 0;
  font-size: 0.95rem;
}

.social-links {
  display: flex;
  gap: 12px;
}

.social-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  transition: all var(--transition-fast);
}

.social-btn:hover {
  background-color: var(--primary);
  color: #FFFFFF;
  transform: translateY(-3px);
}

.footer-col-title {
  font-family: var(--font-primary);
  font-size: 1.1rem;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 24px;
  position: relative;
}

.footer-col-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 30px;
  height: 2px;
  background: var(--gradient-accent);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-link a {
  color: #94A3B8;
  font-size: 0.95rem;
  display: inline-block;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.footer-link a:hover {
  color: #FFFFFF;
  transform: translateX(4px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #64748B;
}

.footer-bottom-links {
  display: flex;
  gap: 24px;
}

.footer-bottom-links a:hover {
  color: #FFFFFF;
}

/* Newsletter Form */
.newsletter-form {
  margin-top: 16px;
}

.newsletter-input-group {
  display: flex;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--border-radius);
  padding: 4px;
  width: 100%;
}

.newsletter-input-group input {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 16px;
  color: #FFFFFF;
  outline: none;
}

.newsletter-input-group input::placeholder {
  color: rgba(255, 255, 255, 0.85);
}

.newsletter-input-group button {
  background: var(--gradient-primary);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.newsletter-input-group button:hover {
  filter: brightness(1.1);
}

/* 4. Interactive Dialog Popups & Float Buttons */
/* Callbacks Dialog Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 18, 29, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  position: relative;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--primary);
}

.modal-title {
  margin-bottom: 12px;
  font-size: 1.5rem;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
}

.form-control {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 12px 16px;
  outline: none;
  font-family: var(--font-secondary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
}

/* Floating Widgets Sticky Container */
.floating-widgets {
  position: fixed;
  bottom: 40px;
  right: 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 999;
}

.widget-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.widget-whatsapp {
  background-color: #25D366;
}

.widget-whatsapp:hover {
  transform: scale(1.1) translateY(-3px);
  background-color: #20BA5A;
}

.widget-call {
  background-color: var(--primary);
}

.widget-call:hover {
  transform: scale(1.1) translateY(-3px);
  background-color: #0070EB;
}

.widget-tooltip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background-color: var(--dark);
  color: #FFFFFF;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}

.widget-btn:hover .widget-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* Back To Top Button */
.back-to-top {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--card-bg);
  color: var(--primary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
}

.back-to-top.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background-color: var(--primary);
  color: #FFFFFF;
  transform: translateY(-3px);
}

/* Cookie Consent Notification Bar */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  max-width: 420px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--border-radius);
  padding: 24px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(150px);
  opacity: 0;
  transition: all var(--transition-slow);
}

.cookie-banner.active {
  transform: translateY(0);
  opacity: 1;
}

.cookie-banner p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.cookie-actions {
  display: flex;
  gap: 12px;
}

/* 5. Custom Preloading Overlay Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-logo {
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 2rem;
  color: #FFFFFF;
  margin-bottom: 20px;
  animation: logoPulse 1.5s ease-in-out infinite;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(10, 132, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinnerSpin 1s linear infinite;
}

@keyframes logoPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.02); }
}

@keyframes spinnerSpin {
  to { transform: rotate(360deg); }
}
