/* ------------------------------
   Global Styles
------------------------------ */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 0;
    height: 100vh;
  }
  
  /* ------------------------------
     Auth Pages (Login / Register)
  ------------------------------ */
  .auth-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    width: 320px;
    margin: auto;
    margin-top: 100px;
  }
  
  .auth-container h2 {
    text-align: center;
  }
  
  .auth-container form {
    display: flex;
    flex-direction: column;
  }
  
  .auth-container input {
    margin: 0.5rem 0;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 8px;
  }
  
  .auth-container button {
    padding: 0.75rem;
    background-color: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    margin-top: 1rem;
    cursor: pointer;
  }
  
  .auth-container button:hover {
    background-color: #285cc4;
  }
  
  .auth-container p {
    text-align: center;
    margin-top: 1rem;
  }
  
  /* ------------------------------
     Navbar
  ------------------------------ */
  .navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    box-sizing: border-box;
    box-shadow: 0 2px 12px rgba(79,70,229,0.25);
  }
  
  .nav-left h3 {
    margin: 0;
  }
  
  .nav-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
  
  .nav-right a,
  .nav-right button {
    margin-left: 0.8rem;
    color: white;
    text-decoration: none;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .nav-right a.active {
    font-weight: 700;
    border-bottom: 2px solid #a5b4fc;
    padding-bottom: 2px;
    color: #a5b4fc;
  }

  .nav-logout {
    padding: 0.25rem 0.75rem !important;
    background-color: #4f46e5 !important;
    border-radius: 6px !important;
    margin-left: 0.8rem;
  }

  .nav-logout:hover {
    background-color: #4338ca !important;
  }

  .nav-right a:hover {
    color: #a5b4fc;
  }

  .nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    margin-left: auto;
  }

  @media (max-width: 768px) {
    .navbar {
      flex-wrap: wrap;
      padding: 0.75rem 1rem;
    }
    .nav-hamburger {
      display: block;
    }
    .nav-right {
      display: none;
      flex-direction: column;
      width: 100%;
      padding: 0.5rem 0;
      gap: 0.1rem;
    }
    .nav-right.open {
      display: flex;
    }
    .nav-right a,
    .nav-right button {
      margin-left: 0;
      padding: 0.5rem 0;
      border-bottom: 1px solid rgba(255,255,255,0.1);
      width: 100%;
    }
    .nav-logout {
      background: none !important;
      border-radius: 0 !important;
      text-align: left;
      margin-left: 0 !important;
    }
  }

  @media (max-width: 768px) {
    [dir="rtl"] .nav-logout { text-align: right; }
    [dir="rtl"] .nav-right a,
    [dir="rtl"] .nav-right button { margin-right: 0; }
    [dir="rtl"] .nav-drop-menu a { padding: 0.5rem 1.25rem 0.5rem 0; }
  }
  
  /* ------------------------------
     Toast Notifications
  ------------------------------ */
  .toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4caf50;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
  }
  
  .toast.show {
    opacity: 1;
    pointer-events: auto;
  }
  
  .toast.error {
    background-color: #e74c3c;
  }
  
  .toast.hidden {
    display: none;
  }
  
  /* ------------------------------
     General Utility Classes
  ------------------------------ */
  .centered {
    text-align: center;
  }
  
  .mt-2 {
    margin-top: 2rem;
  }

/* ------------------------------
   Dropdown Navigation (click-based)
------------------------------ */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-drop-btn {
  margin-left: 0.8rem;
  color: rgba(255,255,255,0.85);
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.nav-drop-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.nav-drop-btn.active {
  color: #a5b4fc;
  font-weight: 700;
}
.nav-dropdown.open .nav-drop-btn {
  color: #a5b4fc;
  background: rgba(165,180,252,0.15);
}

.drop-arrow {
  font-size: 0.6rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
  display: inline-block;
}
.nav-dropdown.open .drop-arrow { transform: rotate(180deg); }

/* Dropdown panel — uses visibility+opacity for smooth animation */
.nav-drop-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.4rem 0;
  min-width: 175px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  z-index: 1200;
  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  pointer-events: none;
}

/* Caret arrow pointing up to the button */
.nav-drop-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 18px;
  width: 10px;
  height: 10px;
  background: #1e293b;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-left: 1px solid rgba(255,255,255,0.1);
  transform: rotate(45deg);
}

/* Open state — NO hover trigger, click-only */
.nav-dropdown.open .nav-drop-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-drop-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 1.1rem;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.84rem;
  transition: background 0.12s, color 0.12s;
  border-radius: 0;
}
.nav-drop-menu a:first-of-type { border-radius: 8px 8px 0 0; }
.nav-drop-menu a:last-of-type  { border-radius: 0 0 8px 8px; }
.nav-drop-menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-drop-menu a.active {
  color: #a5b4fc;
  font-weight: 700;
  background: rgba(165,180,252,0.12);
}
.nav-drop-menu a .menu-icon {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-svg-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

/* Divider between menu groups */
.nav-drop-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 0.25rem 0;
}

/* Section label inside dropdown */
.nav-drop-label {
  display: block;
  padding: 0.45rem 1.1rem 0.1rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  pointer-events: none;
  user-select: none;
}

/* ── RTL overrides ───────────────────────────────────────────────────────── */
/* Inherit text direction throughout the page */
[dir="rtl"] body { direction: rtl; }

[dir="rtl"] .nav-right { flex-direction: row-reverse; }
[dir="rtl"] .nav-right a,
[dir="rtl"] .nav-right button,
[dir="rtl"] .nav-drop-btn { margin-left: 0; margin-right: 0.8rem; }
[dir="rtl"] .nav-logout   { margin-left: 0; margin-right: 0.8rem; }
[dir="rtl"] .nav-hamburger { margin-left: 0; margin-right: auto; }

[dir="rtl"] .nav-drop-menu {
  left: auto;
  right: 0;
}
[dir="rtl"] .nav-drop-menu::before {
  left: auto;
  right: 18px;
}

/* ── Language/calendar settings widget ─────────────────────────────────── */
.locale-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.locale-bar label { font-size: 0.82rem; color: rgba(255,255,255,0.8); white-space: nowrap; }
.locale-bar select {
  font-size: 0.78rem;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  outline: none;
}
.locale-bar select option { background: #1e293b; color: #fff; }

/* Mobile: inline expansion */
@media (max-width: 768px) {
  .nav-dropdown {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .nav-drop-btn {
    margin-left: 0;
    padding: 0.5rem 0;
    border-radius: 0;
    width: 100%;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: none !important;
  }
  .nav-drop-menu {
    position: static;
    opacity: 1;
    visibility: hidden;
    transform: none;
    max-height: 0;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    pointer-events: none;
    transition: max-height 0.25s ease, visibility 0.25s;
  }
  .nav-drop-menu::before { display: none; }
  .nav-dropdown.open .nav-drop-menu {
    max-height: 200px;
    visibility: visible;
    pointer-events: auto;
  }
  .nav-drop-menu a {
    padding: 0.5rem 0 0.5rem 1.25rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
}
