nav {
  background: var(--purple-2);
  padding-block: 12px;
  padding: 2rem 0;
}
nav .site-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  flex: 0 0 auto;
}
nav .brand a {
  font-weight: 800;
  font-size: clamp(1.5rem, 2vw, 1.35rem);
  letter-spacing: 0.2px;
  color: #fff;
}

nav .menu__links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  justify-content: center;
}

nav .menu__links a {
  color: #fff;
  opacity: 0.95;
  position: relative;
  transition: color 0.25s ease, opacity 0.25s ease;
  font-size: clamp(1rem, 1vw, 1.2rem);
}

nav .menu__links a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -4px; /* مسافة بسيطة تحت النص */
  width: 0%;
  height: 2px;
  background: var(--aqua); /* التركواز */
  transition: width 0.3s ease;
  border-radius: 999px;
}

nav .menu__links a:hover {
  color: var(--aqua); /* يتحول للتركواز */
  opacity: 1;
}

nav .menu__links a:hover::after {
  width: 100%;
}

.nav__button {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 1.5vw, 0.8rem);
  margin-inline-start: auto;
}
.nav__button a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: clamp(0.45rem, 1.2vw, 0.6rem) clamp(1rem, 2.2vw, 1.2rem);
  border-radius: 10px;
  font-weight: 700;
  font-size: clamp(0.9rem, 1.6vw, 1rem);
  line-height: 1;
  transition: transform 0.25s, box-shadow 0.3s, background 0.2s, color 0.2s,
    border-color 0.2s;
  min-height: 2.6rem;
  white-space: nowrap;
}
.btn-login {
  background: transparent;
  border: 2px solid #fff;
  color: #fff;
}
.btn-login:hover {
  background: var(--aqua);
  border-color: var(--aqua);
  color: #2b2140;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(65, 230, 192, 0.35);
}
.btn-signup {
  background: var(--aqua);
  border: 2px solid var(--aqua);
  color: #2b2140;
}
.btn-signup:hover {
  background: transparent;
  color: #fff;
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(255, 255, 255, 0.25);
}

.mobile-menu {
  position: fixed;
  top: 50px;
  right: -100%;
  width: 80%;
  max-width: 340px;
  height: 100%;
  background: #fff;
  box-shadow: -6px 0 25px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.35s ease;
  border-radius: 12px 0 0 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-menu.active {
  right: 0;
}

.mobile-menu__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 2px solid var(--purple);
}
.mobile-menu__header h3 {
  margin: 0 auto;
  color: var(--purple);
  font-size: 1.15rem;
  font-weight: 800;
}

.close-btn {
  font-size: 2rem;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--purple);
  background: rgba(75, 31, 111, 0.08); /* خلفية شفافة خفيفة */
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.close-btn:hover {
  transform: rotate(90deg) scale(1.05);
  background: var(--aqua);
  color: #2b2140;
  border-color: var(--aqua);
  box-shadow: 0 8px 18px rgba(65, 230, 192, 0.35);
}

.mobile-menu__auth {
  padding: 1rem 1rem 0;
  display: grid;
  gap: 0.6rem;
}
.mobile-menu__auth a {
  display: block;
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.25s ease;
}
.mobile-menu__auth .btn-login {
  border: 2px solid var(--purple);
  color: var(--purple);
  background: #fff;
}
.mobile-menu__auth .btn-login:hover {
  background: var(--purple);
  color: #fff;
}
.mobile-menu__auth .btn-signup {
  background: var(--aqua);
  color: #2b2140;
  border: 2px solid var(--aqua);
}
.mobile-menu__auth .btn-signup:hover {
  background: #35d6b6;
  border-color: #35d6b6;
}

.mobile-menu__about {
  padding: 0.75rem 1rem 0;
}
.mobile-menu__about p {
  margin: 0;
  color: #555;
  line-height: 1.8;
  font-size: 0.95rem;
  border: 1px solid rgba(75, 31, 111, 0.15);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  background: #fafafa;
}

.mobile-menu__links {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.mobile-menu__links a {
  display: block;
  color: var(--purple);
  font-weight: 700;
  text-decoration: none;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  transition: background 0.2s, color 0.2s;
}
.mobile-menu__links a:hover {
  background: var(--aqua);
  color: #2b2140;
}

.mobile-menu__social {
  margin: 1rem 1rem 1.25rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  border-top: 1px dashed rgba(75, 31, 111, 0.25);
  padding-top: 0.9rem;
}
.mobile-menu__social a {
  color: #fff;
  background: var(--purple);
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform 0.2s, background 0.2s;
}
.mobile-menu__social a:hover {
  background: var(--aqua);
  color: #2b2140;
  transform: translateY(-2px);
}

.menu__icon {
  display: none;
}

@media (max-width: 768px) {
  nav {
    padding: 10px 0;
  }
  .nav__button {
    margin: 0;
  } /* يلغي الهامش الصغير اللي أضفته */
  .site-container {
    row-gap: 0.25rem;
  } /* يقلل فراغ الشبكة بين الصفوف */

  nav .menu__links {
    display: none;
  }

  /* زر الهامبرجر */
  .menu__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aqua);
    background: rgba(75, 31, 111, 0.15);
    border: 2px solid var(--purple);
    border-radius: 10px;
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 3;
  }
  .menu__icon:hover,
  .menu__icon:focus {
    background: var(--aqua);
    color: #2b2140;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  }

  /* شبكة الناف في الموبايل */
  nav .site-container {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand menu"
      "auth  auth";
    align-items: center;
    gap: 0.55rem;
  }
  .brand {
    grid-area: brand;
    justify-self: center;
  }
  .nav__button {
    grid-area: auth;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin: 0.25rem 0 0;
  }
  .nav__button a {
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
  }
}

@media (max-width: 380px) {
  .mobile-menu {
    max-width: 92vw;
  }
}

/* ====== Greeting chip in desktop header ====== */
.nav__button .user-chip{
  display:inline-flex; align-items:center; gap:.5rem;
  padding:.45rem .75rem; border:2px solid #fff; border-radius:10px;
  color:#fff; text-decoration:none;
}
.nav__button .user-chip img{
  width:28px; height:28px; border-radius:50%;
  border:2px solid var(--aqua); object-fit:cover;
}
.nav__button .btn-logout{
  color:#fff; opacity:.9; text-decoration:none;
  padding:.45rem .75rem; border:2px solid transparent;
}
.nav__button .btn-logout:hover{ opacity:1; text-decoration:underline; }

/* ====== Greeting block in mobile menu ====== */
.mobile-menu__auth .user-greeting{
  display:flex; align-items:center; gap:.6rem;
  padding:.65rem .75rem;
  border:1px dashed rgba(75,31,111,.25);
  border-radius:10px; color:var(--purple);
  background:#fafafa;
}
.mobile-menu__auth .user-greeting .user-avatar{
  width:36px; height:36px; border-radius:50%;
  border:2px solid var(--aqua); object-fit:cover;
}
.mobile-menu__auth .btn-logout{
  display:block; text-align:center; margin-top:.5rem;
  padding:.75rem 1rem; border-radius:10px; font-weight:700;
  background: var(--purple); color:#fff; text-decoration:none;
  transition: background .25s ease, transform .2s ease;
}
.mobile-menu__auth .btn-logout:hover{
  background: var(--aqua); color:#2b2140; transform: translateY(-2px);
}

