/* =================================================
   COMPONENTS CSS
   All custom UI components live here
================================================= */

/* ===============================
   NAV COMPONENTS
================================ */

/* ---------- Language Switcher ---------- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: sans-serif;
}

.lang-label {
  font-size: 12px;
  font-weight: 500;
  color: #eaeaea;
  transition: 0.3s;
}

#langToggle {
  display: none;
}

.switch {
  width: 64px;
  height: 30px;
  background: #eaeaea;
  border-radius: 30px;
  position: relative;
  box-sizing: border-box;
  cursor: pointer;
  box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.15);
}

.knob {
  width: 26px;
  height: 26px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background-color: #ffffff;
  background-image: url("../images/flag-my.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  transition: 0.25s ease, background-image 0.25s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.flag {
  width: 24px;
  height: 24px;
  position: absolute;
  transition: 0.3s;
}

.flag-en {
  opacity: 0;
}

#langToggle:checked~.switch .knob {
  transform: translateX(32px);
  background-image: url("../images/flag-en.svg");
}

#langToggle:checked+.switch .flag-my {
  opacity: 0;
}

#langToggle:checked+.switch .flag-en {
  opacity: 1;
}

#langToggle:checked~.right {
  color: #333;
}

#langToggle:not(:checked)~.left {
  color: #333;
}

/* ---------- Login Icon ---------- */
.nav-login {
  display: flex;
  align-items: center;
}

.nav-login a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  line-height: 40px;
  padding: 0 10px;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

.nav-login a i {
  font-size: 15px;
  line-height: 1;
  display: block;
}

.nav-login a:hover {
  opacity: 0.7;
}

.header-area:not(.background-header) .nav-login a i {
  color: #ffffff;
}

.background-header .nav-login a i {
  color: #1e1e1e;
}

/* ===============================
   CALCULATOR COMPONENT
================================ */

.calculator-form {
  background: #ffffff;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  margin-top: 20px;
}

.calculator-form input {
  height: 52px;
  font-size: 15px;
}

.calculator-form .main-button {
  width: 100%;
  padding: 16px 22px;
  font-size: 16px;
  font-weight: 700;

  background: #F2B705;
  color: #0A1628;

  border: none;
  border-radius: 12px;

  box-shadow: 0 12px 28px rgba(242, 183, 5, 0.45);
  transition: all 0.25s ease;
}

.calculator-form .main-button:hover {
  background: #0A1628;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(10, 22, 40, 0.5);
}

.calculator-form .main-button:active {
  transform: scale(0.98);
}

/* ===============================
   RESULT BOX
================================ */

.result-box {
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 20px;
  border-radius: 8px;
  text-align: left;
}

/* ===============================
   CHECKBOX UI
================================ */

.custom-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-check .form-check-input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.custom-check .form-check-label {
  font-size: 15px;
  color: #333;
  cursor: pointer;
}

/* ===============================
   UTILITIES
================================ */

/* COMPACT UTILITIES GROUP */
.header-area .nav-utils {
  display: flex;
  align-items: center;
  gap: 6px;
  /* jarak antara switcher, login, CTA */
}

.header-area .nav-login a {
  width: 32px;
  padding: 0;
}

.header-area .nav-utils>* {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  padding-left: 10px;
}

.header-area .nav-cta {
  margin: 0;
}

.d-none {
  display: none !important;
}

.blur {
  filter: blur(7px);
  user-select: none;
}

.header-area .nav-utils+.nav-cta {
  margin-left: 4px;
}

.switch .knob {
  background-image: url("../images/flag-my.svg");
}

/* ===============================
   LANG SWITCH - DEFAULT HEADER
   (hero / sebelum scroll)
================================ */

.header-area:not(.background-header) .switch {
  background: rgba(255, 255, 255, 0.85);
}

.header-area:not(.background-header) .knob {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.header-area:not(.background-header) .lang-label {
  color: #ffffff;
  opacity: 0.85;
}

/* ===============================
   LANG SWITCH - STICKY HEADER
   (scroll state)
================================ */

.background-header .switch {
  background: #eaeaea;
}

.background-header .knob {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.background-header .lang-label {
  color: #2a2a2a;
  opacity: 0.6;
}

/* ===============================
   HARD FIX: STOP HEADER JUMP
================================ */

/* lock logo position */
.header-area .main-nav a.logo,
.background-header .main-nav a.logo {
  margin-top: 10px !important;
}

/* ===============================
   FINAL OVERRIDE — TEMPLATE KILL
================================ */

/* lock header height consistently */
.header-area.header-sticky,
.header-area {
  height: 80px !important;
}

/* lock logo vertical position */
.header-area.header-sticky .main-nav a.logo,
.header-area .main-nav a.logo {
  margin-top: 10px !important;
}

/* ===============================
   TRUE FIX: ALIGN UTILITIES WITH NAV BASELINE
================================ */

/* keep utility items aligned like normal nav items */
.header-area .main-nav .nav>li {
  display: flex;
  align-items: center;
}

/* tighter spacing for utilities */
.header-area .main-nav .nav>li.nav-lang,
.header-area .main-nav .nav>li.nav-login {
  padding-left: 10px;
  padding-right: 10px;
}

/* ===============================
   ICON-ONLY LOGIN — HARD ALIGN FIX
================================ */

/* force nav item baseline */
.header-area .main-nav .nav>li.nav-login {
  height: 40px;
  display: flex;
  align-items: center;
}

/* force icon centering */
.header-area .main-nav .nav>li.nav-login a {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

/* icon visual */
.header-area .main-nav .nav>li.nav-login i {
  font-size: 15px;
  line-height: 1;
}

/* ===============================
   CTA — SAME BEHAVIOR AS ORIGINAL
================================ */

/* sticky header = yellow */
.background-header .main-nav .nav .nav-cta a {
  background-color: #F2B705;
  color: #fff !important;
}

/* hover (non-sticky & sticky) = dark */
.header-area .main-nav .nav .nav-cta a:hover {
  background-color: #0A1628;
  color: #fff !important;
}

.background-header .nav-cta a i {
  background-color: #fff;
  color: #F2B705;
}

.header-area .nav-cta a:hover i {
  background-color: #fff;
  color: #0A1628;
}

/* ===============================
   CTA BUTTON — FINAL COLOR LOGIC
================================ */

/* DEFAULT (before scroll) */
.header-area .nav-cta a {
  background-color: #ffffff;
  color: #2a2a2a;
  margin: 0;
  padding: 8px 14px;
  transition: all 0.3s ease;
}

.header-area .nav-cta a i {
  background-color: #F2B705;
  color: #ffffff;
}

/* STICKY (after scroll) */
.background-header .nav-cta a {
  background-color: #F2B705;
  color: #ffffff;
}

.background-header .nav-cta a i {
  background-color: #ffffff;
  color: #F2B705;
}

/* HOVER (any state) */
.header-area .nav-cta a:hover {
  background-color: #0A1628;
  color: #ffffff;
}

.header-area .nav-cta a:hover i {
  background-color: #ffffff;
  color: #0A1628;
}

/* ===============================
   CTA ICON — VISUAL FIX
================================ */

/* base icon */
.header-area .nav-cta a i {
  width: 22px;
  height: 22px;
  line-height: 22px;

  font-size: 12px;
  font-weight: 600;

  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  margin-right: 6px;
}

/* better contrast for default state */
.header-area .nav-cta a i {
  color: #0A1628;
  /* gelap */
}

/* ======================================
   NAV UTILITIES — FINAL ALIGNMENT FIX
====================================== */

/* override template padding untuk utilities */
.header-area .main-nav .nav>li.nav-utils {
  padding-left: 8px !important;
  padding-right: 0 !important;
}

/* rapatkan item dalam utilities */
.header-area .nav-utils {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* buang extra spacing setiap child */
.header-area .nav-utils>* {
  margin: 0 !important;
  padding: 0 !important;
}

/* login icon betul-betul center & rapat */
.header-area .nav-login a {
  width: 32px;
  height: 32px;
  padding: 0 !important;
}

/* CTA jangan tolak ke kanan */
.header-area .nav-cta {
  margin-left: 4px !important;
}

/* ======================================
   FINAL NAV UTILITIES ALIGNMENT FIX
====================================== */

/* override template spacing */
.header-area .main-nav .nav>li.nav-lang,
.header-area .main-nav .nav>li.nav-login,
.header-area .main-nav .nav>li.nav-cta {
  padding-left: 6px !important;
  padding-right: 6px !important;
}

.header-area .nav-cta a.main-white-button {
  margin-left: 0 !important;
}

.nav-login {
  position: relative;
}

.auth-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 18px;
  cursor: pointer;
}

.auth-email {
  font-size: 12px;
  color: #bbb;
  margin-bottom: 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
}

.auth-footer {
  font-size: 11px;
  color: #888;
  text-align: center;
  margin-top: 8px;
}

.main-nav .nav {
  display: flex;
  align-items: center;
}

.nav-cta {
  order: 1;
}

.nav-lang {
  order: 2;
  margin-left: 12px;
}

.nav-login {
  order: 3;
  margin-left: 10px;
}

.auth-popover {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;

  background: linear-gradient(180deg, #0A1628 0%, #0E1F38 100%);
  border: 1px solid rgba(242, 183, 5, 0.2);
  border-radius: 14px;
  padding: 18px;

  box-shadow: 0 15px 40px rgba(0, 0, 0, .45);
  z-index: 9999;

  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
}

.auth-popover.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.auth-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 18px;
  width: 14px;
  height: 14px;

  background: #0A1628;
  border-left: 1px solid rgba(242, 183, 5, 0.2);
  border-top: 1px solid rgba(242, 183, 5, 0.2);

  transform: rotate(45deg);
}

.auth-view h4 {
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.auth-view input {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.auth-view input:focus {
  outline: none;
  border-color: #F2B705;
  background: rgba(255, 255, 255, 0.1);
}

.auth-btn {
  width: 100%;
  padding: 9px;
  margin-bottom: 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  transition: 0.25s;
}

.auth-btn:hover {
  background: rgba(242, 183, 5, 0.12);
  border-color: #F2B705;
}

.auth-btn.primary {
  background: #F2B705;
  color: #0A1628;
  border: none;
  font-weight: 700;
}

.auth-btn.primary:hover {
  background: #FFC107;
}

.auth-btn.danger {
  color: rgba(255, 255, 255, 0.65);
  border-color: rgba(255, 255, 255, 0.25);
}

.auth-btn.danger:hover {
  background: rgba(255, 80, 80, 0.15);
  color: #ff6b6b;
}

.auth-switch {
  text-align: center;
  font-size: 12px;
  color: #aaa;
}

.auth-switch span {
  color: #fff;
  cursor: pointer;
  text-decoration: underline;
}

.auth-avatar {
  width: 56px;
  height: 56px;
  background: #F2B705;
  color: #0A1628;
  border-radius: 50%;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 22px;
}

/* FORCE LANG TEXT VISIBLE ON HERO */
.header-area:not(.background-header) .lang-label {
  color: #0A1628 !important;
  opacity: 1 !important;
}

/* FORCE LOGIN ICON VISIBLE ON HERO */
.header-area:not(.background-header) .nav-login a i {
  color: #0A1628 !important;
}

/* ===============================
   CATEGORY GRID — OVERRIDE TEMPLATE
=============================== */

.main-banner ul.categories {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 30px 0 20px;
}

.main-banner ul.categories li {
  width: 140px !important;
  display: flex !important;
  justify-content: center;
}

.main-banner ul.categories a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.main-banner ul.categories .icon {
  width: 66px;
  height: 66px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.main-banner ul.categories .label {
  min-height: 40px;
  /* 2 baris BM */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  font-size: 15px;
}