/* Shared Styles - Base, Navbar, Footer, Mobile Menu, Scroll-to-Top */

/* ===== BASE ===== */
:root {
  --font-heading: 'Playfair Display', sans-serif;
  --font-body: 'Inter', sans-serif;
  --primary: #003B5C;
  --primary-light: #005A8C;
  --primary-dark: #002640;
  --accent: #00A6D6;
  --accent-light: #40C4E8;
  --white: #FFFFFF;
  --off-white: #F5F7FA;
  --gray-100: #EEF1F5;
  --gray-200: #D8DDE5;
  --gray-300: #B0B8C5;
  --gray-600: #5A6675;
  --gray-800: #2C3542;
  --gray-900: #1a1d21;
  --dark: #0D1B2A;
  --gradient-hero: linear-gradient(135deg, #003B5C 0%, #005A8C 25%, #002640 50%, #00A6D6 100%);
  --gradient-accent: linear-gradient(135deg, #00A6D6, #0088B0);
  --shadow-sm: 0 4px 12px rgba(0, 59, 92, 0.06);
  --shadow-md: 0 12px 40px rgba(0, 59, 92, 0.08);
  --shadow-lg: 0 20px 80px rgba(0, 59, 92, 0.12);
  --shadow-card: 0 8px 30px rgba(0, 59, 92, 0.08);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100vw }
body {
  font-family: var(--font-body);
  color: var(--gray-800);
  background: var(--white);
  overflow-x: hidden;
  line-height: 1.7;
}

::-webkit-scrollbar { width: 10px }
::-webkit-scrollbar-track { background: var(--off-white) }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; border: 2px solid var(--off-white) }
::-webkit-scrollbar-thumb:hover { background: var(--accent) }

/* ===== NAVBAR ===== */
/* Default state: transparent (for pages with dark hero like index) */
/* Scrolled state: solid white (applied immediately on non-home pages via JS) */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 4%;
  height: 80px;
  display: flex;
  align-items: center;
  font-family: var(--font-body);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1)
}

/* Backdrop-filter on pseudo-element to avoid blurring child content (logo) */
.navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              backdrop-filter 0.4s cubic-bezier(0.16, 1, 0.3, 1)
}

.navbar.scrolled {
  border-bottom: 1px solid rgba(0, 59, 92, 0.06);
  box-shadow: 0 4px 12px rgba(0, 59, 92, 0.05)
}

.navbar.scrolled::before {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px)
}

/* Logo - left on desktop */
.navbar-logo {
  position: relative;
  display: flex;
  align-items: center
}

.navbar-logo img {
  height: 60px;
  width: auto;
  transition: opacity 0.3s ease
}

.navbar-logo .logo-white {
  opacity: 1
}

.navbar-logo .logo-dark {
  position: absolute;
  left: 0;
  opacity: 0
}

.navbar.scrolled .navbar-logo .logo-white {
  opacity: 0
}

.navbar.scrolled .navbar-logo .logo-dark {
  opacity: 1
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin-left: auto
}

.nav-links a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-nav, var(--font-body));
  font-weight: 500;
  font-size: var(--font-nav-size, 0.9rem);
  padding: 8px 20px;
  border-radius: 100px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: 0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
  border: 1px solid transparent
}

.navbar.scrolled .nav-links a {
  color: #2D3540;
  text-shadow: none
}

.nav-links a:hover {
  background: radial-gradient(ellipse at 30% 0%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 100%);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    inset 2px 0 8px rgba(255, 255, 255, 0.08),
    inset -2px 0 8px rgba(255, 255, 255, 0.05);
  color: #FFFFFF;
  transform: translateY(-1px) scale(1.03);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.4)
}

.navbar.scrolled .nav-links a:hover {
  background: radial-gradient(ellipse at 30% 0%, rgba(255,255,255,0.7) 0%, rgba(240,249,255,0.5) 50%, rgba(230,245,255,0.3) 100%);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-color: rgba(0, 166, 214, 0.25);
  box-shadow:
    0 8px 32px rgba(0, 59, 92, 0.08),
    0 2px 8px rgba(0, 166, 214, 0.06),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.3),
    inset 2px 0 8px rgba(255, 255, 255, 0.15),
    inset -2px 0 8px rgba(255, 255, 255, 0.1);
  color: #003B5C;
  transform: translateY(-1px) scale(1.03);
  text-shadow: none
}

/* CTA button */
.nav-cta {
  background: #00A6D6 !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  padding: 10px 24px !important;
  box-shadow: 0 8px 20px rgba(0, 166, 214, 0.3) !important
}

.nav-cta:hover {
  background: #40C4E8 !important;
  box-shadow: 0 12px 24px rgba(0, 166, 214, 0.4) !important
}

/* Language switcher */
.lang-flag {
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 6px;
  transition: opacity .2s, transform .2s;
  opacity: .85;
  margin-left: 8px;
  text-decoration: none
}
.lang-flag:hover {
  opacity: 1;
  transform: scale(1.1)
}
.lang-flag-svg {
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  display: block
}
.lang-flag-label {
  display: none
}
.mobile-lang-switcher .lang-flag-label {
  display: inline
}
.mobile-lang-switcher {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center
}
.mobile-lang-switcher .lang-flag {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  opacity: 1;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: .3px
}
.mobile-lang-switcher .lang-flag:hover {
  background: rgba(255,255,255,.15)
}
.mobile-lang-switcher .lang-flag-svg {
  width: 20px;
  height: 15px
}

/* Mobile toggle - fixed element outside navbar */
.mobile-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  padding: 10px;
  position: fixed;
  top: 18px;
  right: 16px;
  z-index: 1001
}
@media(min-width:969px) {
  .mobile-toggle { display: none !important }
}

.mobile-toggle span {
  width: 26px;
  height: 2.5px;
  background: #FFFFFF;
  border-radius: 2px;
  transition: all 0.3s ease
}

.mobile-toggle.dark span {
  background: #2D3540
}

/* NAVBAR USER MENU (Calculator logged-in user) */
.calc-user-menu {
  position: relative;
  margin-left: 12px;
}
.calc-user-btn {
  background: none;
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 24px;
  transition: background 0.2s, color 0.3s;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.navbar.scrolled .calc-user-btn { color: var(--primary); text-shadow: none; }
.calc-user-btn:hover { background: rgba(255,255,255,0.1); }
.navbar.scrolled .calc-user-btn:hover { background: rgba(0,59,92,0.06); }
.calc-user-btn .bi-person-circle { font-size: 1.2rem; }
.calc-user-chevron { font-size: 0.65rem; transition: transform 0.2s; }
.calc-user-menu.open .calc-user-chevron { transform: rotate(180deg); }
.calc-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 1000;
}
.calc-user-menu.open .calc-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.calc-user-dropdown a,
.calc-user-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700, #5A6675);
  text-decoration: none;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s;
}
.calc-user-dropdown a:hover,
.calc-user-dropdown button:hover {
  background: var(--off-white);
  color: var(--primary);
}
.calc-user-dropdown i { font-size: 1rem; width: 18px; text-align: center; }

/* MOBILE MENU */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: #003B5C;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1)
}

.mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0)
}

.mobile-logo { display: block; text-align: center; margin-bottom: 24px; padding: 0 24px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px }
.mobile-logo img { height: 48px; width: auto; opacity: 0.9 }

.mobile-menu a {
  color: #FFFFFF;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition: background 0.3s ease, transform 0.3s ease
}

.mobile-menu.open a {
  opacity: 1;
  transform: translateY(0)
}

.mobile-menu.open a:nth-child(2) { transition-delay: 0.1s }
.mobile-menu.open a:nth-child(3) { transition-delay: 0.15s }
.mobile-menu.open a:nth-child(4) { transition-delay: 0.2s }
.mobile-menu.open a:nth-child(5) { transition-delay: 0.25s }
.mobile-menu.open a:nth-child(6) { transition-delay: 0.3s }

.mobile-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(0) scale(1.05)
}

.mobile-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 12px;
  color: #FFFFFF;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: rotate(0deg) scale(0.8)
}

.mobile-menu.open .mobile-close {
  opacity: 1;
  transform: rotate(90deg) scale(1);
  transition-delay: 0.2s
}

.mobile-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg) scale(1.1)
}

/* FOOTER */
.footer {
  background: #0D1B2A;
  padding: 60px 4% 32px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body)
}

.footer-inner {
  max-width: 1300px;
  margin: 0 auto
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px
}

.footer-brand .navbar-logo {
  position: relative;
  left: auto;
  transform: none;
  display: inline-block
}
.footer-brand img {
  height: 44px;
  filter: brightness(0) invert(1);
  margin-bottom: 12px
}

.footer-brand p {
  font-size: 0.85rem;
  line-height: 1.7;
  max-width: 260px
}

.footer-col h4 {
  color: #FFFFFF;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  font-weight: 700
}

.footer-col a {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 3px 0;
  transition: color 0.3s ease
}

.footer-col a:hover {
  color: #40C4E8
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px
}

.footer-bottom p {
  font-size: 0.8rem
}

.footer-socials {
  display: flex;
  gap: 10px
}

.footer-socials a {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: all 0.3s ease
}

.footer-socials a:hover {
  background: #00A6D6;
  color: #FFFFFF
}

/* SCROLL TO TOP BUTTON */
.scroll-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #00A6D6, #0088B0);
  border: none;
  border-radius: 50%;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 166, 214, 0.3);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1)
}

.scroll-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1)
}

.scroll-to-top:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(0, 166, 214, 0.4)
}

.scroll-to-top svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2))
}

/* RESPONSIVE */
@media(max-width:968px) {
  .navbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    max-width: 100vw
  }

  .navbar-logo {
    flex-shrink: 0
  }

  .navbar-logo img {
    height: 40px
  }

  .nav-links {
    display: none !important
  }

  .navbar > .lang-flag {
    display: none !important
  }

  .calc-user-menu {
    position: absolute;
    left: 4%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0
  }
  .calc-user-name { display: none; }
  .calc-user-btn { padding: 6px 8px; }
  .calc-user-dropdown { right: auto; left: 0; min-width: 180px; }

  .footer-top {
    grid-template-columns: 1fr 1fr
  }

  .scroll-to-top {
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px
  }

  .scroll-to-top svg {
    width: 18px;
    height: 18px
  }
}

@media(max-width:640px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: 24px
  }
}
