﻿@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  /* --- ECO THEME PALETTE --- */
  --eco-dark: #1b4d3e;
  /* Deep Forest Green */
  --eco-primary: #2e7d32;
  /* Standard Green */
  --eco-light: #4caf50;
  /* Bright Leaf Green */
  --eco-accent: #81c784;
  /* Highlight Green */
  --white: #ffffff;

  /* --- GLASS & BACKGROUNDS --- */
  /* This ensures the background is always "Greenish", never fully transparent */
  --navbar-bg: rgba(27, 77, 62, 0.85);
  --glass-border: rgba(255, 255, 255, 0.15);
  --dropdown-bg: rgba(20, 50, 30, 0.95);

  /* --- SHADOWS & TRANSITIONS --- */
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.2);
  --transition-normal: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-slow: all 0.5s ease;

  /* --- SIZES --- */
  --radius-md: 8px;
  --radius-xl: 50px;
  --eco-gradient: linear-gradient(135deg, #22c55e, #16a34a);
  --eco-gradient-hover: linear-gradient(135deg, #16a34a, #15803d);
}

* {
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

/* Lock body scroll when mobile nav is open */
body.nav-open {
  overflow: hidden;
  height: 100vh;
}

/* ===== NAVBAR BASE ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  /* Greenish Glass Background (Default) */
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  transition: var(--transition-normal);
  padding: 5px 0;
}

.navbar.scrolled {
  background: rgba(20, 50, 30, 0.95);
  /* Darker/Solid on scroll */
  box-shadow: var(--shadow-lg);
  padding: 0;
}

.nav-container {
  width: 100%;
  padding: 0 30px;
  display: flex;
  align-items: center;
  height: 70px;
}

/* ===== LOGO ===== */
.navbar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
  flex-shrink: 0;
}

.navbar .logo-img {
  width: 36px;
  height: 36px;
}

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

/* ===== LIVE CLOCK DISPLAY ===== */
.live-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: var(--transition-normal);
  flex-shrink: 0;
  width: fit-content;
  /* ⬅️ content jitni width */
  max-width: fit-content;
}

.live-clock:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.live-clock i {
  font-size: 1rem;
  color: var(--eco-accent);
  animation: clockPulse 2s infinite;
}

#clock-time {
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  font-weight: 600;
}

@keyframes clockPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* ===== SEARCH BAR ===== */
.search-container {
  flex: 1;
  max-width: 400px;
}

.search-form {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  transition: var(--transition-normal);
}

.search-form:focus-within {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 20px rgba(129, 199, 132, 0.3);
}

#searchInput {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 0.9rem;
  outline: none;
}

#searchInput::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-btn {
  padding: 10px 16px;
  background: var(--eco-light);
  border: none;
  color: var(--eco-dark);
  cursor: pointer;
  transition: var(--transition-normal);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}

.search-btn:hover {
  background: var(--eco-accent);
  transform: scale(1.05);
}

.search-btn i {
  font-size: 0.9rem;
}

/* ===== NAV LINKS ===== */
.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  list-style: none;
  margin: 0 0 0 25px;
  /* space after logo */
  padding: 0;
  flex: 1;
}

.nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
  position: relative;
  white-space: nowrap;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Icon rotation in links */
.nav-link i {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

@media (min-width: 1201px) {
  .nav-group:hover .nav-link i {
    transform: rotate(180deg);
  }
}

/* Premium Underline Animation */
.nav-link::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--eco-light);
  border-radius: 2px;
  transition: var(--transition-normal);
  box-shadow: 0 0 8px var(--eco-light);
}

.nav-link:hover,
.nav-link.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

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


.font-size-increase {
  margin-left: 15px;
}

/* ===== DROPDOWNS ===== */
.nav-group {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #143822; /* solid deep green for better contrast */
  border: 1px solid var(--glass-border);
  min-width: 200px;
  border-radius: 12px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

/* Hover State */
@media (min-width: 1201px) {
  .nav-group:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(10px);
  }
}

/* Dropdown Links */
.dropdown li {
  list-style: none;
}

.dropdown li a {
  display: block;
  padding: 10px 16px;
  color: #ffffff; /* strong readable white */
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.25s ease;
}

/* Hover */
.dropdown li a:hover {
  background: var(--eco-primary); /* strong hover contrast */
  color: #ffffff;
  padding-left: 20px;
}

/* Keyboard Accessibility */
.dropdown li a:focus {
  outline: 2px solid var(--eco-accent);
  outline-offset: 2px;
  background: var(--eco-primary);
  color: #ffffff;
}



/* ===== RIGHT SIDE (AUTH + PROFILE) ===== */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

/* Login Button */
/* Login Button - 3D White */
.btn-login {
  padding: 8px 16px;
  background-color: var(--white);
  color: var(--eco-dark);
  border: none;
  /* Removed border for 3D effect */
  border-radius: var(--radius-xl);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.1s ease;
  white-space: nowrap;
  text-decoration: none;
  margin-left: 6px;
  position: relative;
  box-shadow: 0 4px 0 #cccccc, 0 5px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(0);
}

.btn-login:hover {
  background-color: #f0f0f0;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #cccccc, 0 3px 5px rgba(0, 0, 0, 0.1);
  color: var(--eco-dark);
  border-color: transparent;
}

.btn-login:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #cccccc, 0 0 0 rgba(0, 0, 0, 0.1);
}

/* Sign Up Button */
/* Sign Up Button - 3D Green */
.btn-signup {
  padding: 8px 16px;
  background: var(--eco-primary);
  color: var(--white);
  border-radius: var(--radius-xl);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.1s ease;
  white-space: nowrap;
  text-decoration: none;
  margin-left: 10px;
  position: relative;
  box-shadow: 0 4px 0 #1b5e20, 0 5px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
}

.btn-signup:hover {
  background: var(--eco-light);
  transform: translateY(2px);
  box-shadow: 0 2px 0 #1b5e20, 0 3px 5px rgba(0, 0, 0, 0.2);
  color: var(--white);
}

.btn-signup:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #1b5e20, 0 0 0 rgba(0, 0, 0, 0.2);
}


/* ===== THEME TOGGLE ===== */
.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--white);
  transition: var(--transition-normal);
  border: 1px solid transparent;
  margin-left: 12px;
  /* spacing from Eco Games */
}

.theme-toggle-btn i {
  font-size: 0.9rem;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
  transform: rotate(15deg) scale(1.05);
}

/* ===== FONT SIZE CONTROLS ===== */
.font-size-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 10px;
}

.font-size-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--white);
  transition: var(--transition-normal);
  border: 1px solid transparent;
  font-size: 14px;
}

.font-size-btn:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.font-size-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
}

.font-size-btn:active:not(.disabled) {
  transform: scale(0.95);
}


/* ===== USER PROFILE SECTION ===== */
.auth-guest-only {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-user-only {
  display: none;
}

/* JS toggles this */

/* Visibility State classes used by JS */
[data-logged-in="true"] .auth-guest-only {
  display: none !important;
}

[data-logged-in="true"] .auth-user-only {
  display: flex !important;
}

[data-logged-in="false"] .auth-guest-only {
  display: flex !important;
}

[data-logged-in="false"] .auth-user-only {
  display: none !important;
}

.nav-profile {
  position: relative;
}

.profile-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50px;
  transition: var(--transition-normal);
}

.profile-menu:hover {
  background: rgba(255, 255, 255, 0.1);
}

.profile-icon {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.profile-arrow {
  font-size: 0.7rem;
  color: var(--white);
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 15px;
  background: var(--dropdown-bg);
  backdrop-filter: blur(15px);
  border-radius: 12px;
  min-width: 180px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
}

.nav-profile:hover .profile-dropdown {
  display: block;
  animation: slideUpFade 0.3s ease;
}

.profile-dropdown li a {
  display: block;
  padding: 10px 16px;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  transition: 0.2s;
}

.profile-dropdown li a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--eco-accent);
}


/* ===== MOBILE MENU TOGGLE ===== */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 10px;
  z-index: 1001;
}

.nav-toggle span {
  width: 28px;
  height: 3px;
  background: var(--white);
  border-radius: 3px;
  transition: var(--transition-normal);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

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

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}


/* =========================================
   RESPONSIVE MEDIA QUERIES
   ========================================= */

/* LAPTOP / SMALL DESKTOP (Switch to Hamburger earlier to prevent crowding) */
@media (max-width: 1200px) {
  .nav-container {
    padding: 0 20px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    height: 100dvh;
    /* safer on mobile browsers */
    background: linear-gradient(180deg, var(--eco-dark), #0d2e23);
    flex-direction: column;
    align-items: flex-start;
    padding: 90px 24px 40px;
    gap: 10px;
    transition: 0.45s cubic-bezier(0.77, 0, 0.175, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1000;
  }

  .nav-links.active {
    right: 0;
  }

  /* Mobile Links */
  .nav-link {
    font-size: 1.1rem;
    width: 100%;
    padding: 12px 0;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .nav-link::after {
    display: none;
  }

  /* Remove underline animation on mobile */

  .nav-link:hover {
    background: transparent;
    padding-left: 10px;
    color: var(--eco-accent);
  }

  /* Mobile Dropdowns */
  .nav-group {
    width: 100%;
    display: block;
    height: auto;
  }

  .dropdown {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: none;
    width: 100%;
    border: none;
    display: none;
    /* Hidden until hover/click */
    padding-left: 15px;
    margin-top: 5px;
  }

  /* Mobile submenu controlled by JS */
  .nav-group.open>.dropdown {
    display: block;
  }

  .dropdown a {
    padding: 12px;
    font-size: 0.95rem;
  }

  /* Mobile Auth Section */
  .nav-auth {
    display: flex;
    /* flex-direction: column; */
    /* width: 100%;
    margin: 30px 0 0 0;
    padding: 20px 0 0 0; */
    /* border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2); */
    margin-left: auto;
    align-items: center;
    gap: 20px;
  }

  .nav-left {
    display: flex;
    align-items: center;
    gap: 35px;
    flex: 1;
  }

  .auth-guest-only {
    width: 100%;
    display: flex;
    gap: 15px;
  }

  .btn-login,
  .btn-signup {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .theme-toggle-btn {
    width: 100%;
    border-radius: 8px;
    justify-content: flex-start;
    padding-left: 20px;
    background: transparent;
  }

  .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
  }

  .theme-toggle-btn::after {
    content: " Toggle Theme";
    margin-left: 10px;
    font-size: 0.9rem;
  }

  /* Mobile Clock Styles */
  .live-clock {
    margin-left: auto;
    padding: 6px 12px;
    font-size: 0.85rem;
  }
}


/* TABLET OPTIMIZATIONS */
@media (max-width: 1024px) {
  .nav-container {
    height: 60px;
  }

  .navbar .logo {
    font-size: 1.4rem;
  }

  /* Smaller clock on tablets */
  .live-clock {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  /* Smaller search bar on tablets */
  .search-container {
    max-width: 300px;
    margin: 0 15px;
  }

  #searchInput {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .search-btn {
    padding: 8px 14px;
  }
}

/* PHONE OPTIMIZATIONS */
@media (max-width: 480px) {
  .nav-container {
    padding: 0 15px;
  }

  .navbar .logo span {
    display: block;
  }

  .navbar .logo-img {
    width: 32px;
    height: 32px;
  }

  .nav-links {
    width: 85%;
    display: flex;
    align-items: center;
    gap: 28px;
  }

  /* Compact clock on phones - hide icon, show only time */
  .live-clock {
    padding: 4px 8px;
    font-size: 0.8rem;
    gap: 0;
  }

  .live-clock i {
    display: none;
  }

  /* Hide search bar on mobile, show only in nav menu */
  .search-container {
    display: none;
  }

  /* Mobile search in menu */
  .mobile-search {
    display: block !important;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-search-form {
    display: flex;
    gap: 10px;
  }

  .mobile-search-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: 1rem;
  }

  .mobile-search-form input::placeholder {
    color: rgba(255, 255, 255, 0.7);
  }

  .mobile-search-form button {
    padding: 12px 16px;
    background: var(--eco-light);
    border: none;
    border-radius: 8px;
    color: var(--eco-dark);
    cursor: pointer;
    transition: var(--transition-normal);
  }

  .mobile-search-form button:hover {
    background: var(--eco-accent);
  }

  /* Full width drawer */
}

/* ANIMATION KEYFRAMES */
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Kids Quiz Button Highlight */
.btn-quiz-highlight {
  background: var(--eco-primary) !important;
  color: var(--white) !important;
  border-radius: var(--radius-xl);
  padding: 8px 20px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(46, 125, 50, 0.3);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.btn-quiz-highlight:hover {
  background: var(--white) !important;
  color: var(--eco-primary) !important;
  border-color: var(--eco-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(46, 125, 50, 0.4);
}

/* ========================================= */
/* ECO GAMES STYLES */
/* ========================================= */

.nav-eco-games {
  font-weight: 600;
}

.nav-eco-games:hover {
  color: #22c55e;
}

/* ============================= */
/* Eco Games Navbar Button */
/* ============================= */

.eco-games-btn {
  flex-shrink: 0;
  background: var(--eco-gradient);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 25px;
  font-weight: 600;
  text-decoration: none;
  margin-right: 15px;
  display: inline-block;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.eco-games-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.4);
}

/* ============================= */
/* Eco Games Corner Button */
/* ============================= */

.eco-games-corner-btn {
  flex-shrink: 0;
  background: var(--eco-gradient);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 30px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
  transition: all 0.3s ease;
}

.eco-games-corner-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.45);
}

/* Push Eco Games fully right */

.nav-right {
  display: flex;
  align-items: center;
}

.language-selector-wrapper {
  display: flex;
  align-items: center;
}

.language-selector {
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  appearance: none;
  /* Premium look */
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  padding-right: 30px;
}

.language-selector:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: var(--eco-accent);
}

.language-selector option {
  background-color: #1b4d3e;
  /* Dark forest green background for list */
  color: #ffffff;
  /* Crisp white text */
  padding: 10px;
}

/* Specific styling for the actual dropdown part */
select:focus option {
  background-color: #1b4d3e;
  color: white;
}