/* =================== */
/* 🧱 SECTION: HEADER working when ... */
/* =================== */
header {
  position: relative;
  z-index: 1000;
  width: 100%;
  background: var(--col-b);
}

header .main__width {
  display:flex; 
  align-items:center; 
  justify-content:space-between;
  padding:.5rem .5rem .5rem 0;
}

/* Logo */
header .header__logo a {
  font-family: var(--fonts);
  font-size: 1.9rem;
  color: var(--col-k);
  text-decoration: none;
  text-shadow: -1px 1px 2px var(--col-s);
}

/* Μην υπογραμμίζεις το logo σε hover/focus (υπερισχύει του global) */
header .header__logo a:hover,
header .header__logo a:focus { text-decoration: none; }

/* Navbar */
header .navbar { 
  line-height:5rem; 
  margin-right:1.9rem; 
  margin-left:auto; 
}

header .nav__items { 
  display:flex; 
  align-items:center; 
}

header .nav__items li {
  position:relative; 
  display:flex; 
  align-items:center;
  list-style:none;
}

/* Νέος κανόνας: μόνο για τα direct children του navbar */
header .navbar > .nav__items > li {
  margin-right: 20px;
  padding:0 10px;
}

header .nav__items li a {
  text-decoration:none; 
  white-space:nowrap;
  color: var(--col-k); 
  font-size:1.275rem;
  letter-spacing:.058125rem; 
  font-weight:500;
}

/* Icons */
header .icons { 
  display:flex; 
  align-items:center; 
  gap:2rem; 
}

/* Dark/light switch */
header .theme-switch { 
  display:inline-block; 
  height:30px; 
  position:relative; 
  width:50px; 
}

header .theme-switch input { 
  display:none; 
}

header .slider {
  position:absolute; 
  height:26px; 
  width:45px;
  background-color: var(--col-q); 
  cursor:pointer; 
  transition:.4s;
}

header .slider:before {
  background-color: var(--col-b);
  content:""; 
  height:22px; 
  width:22px;
  top:2.2px; 
  left:3.4px; 
  position:absolute; 
  transition:.4s;
}

header input:checked + .slider { 
  background-color: var(--col-q); 
}

header input:checked + .slider:before { 
  transform: translateX(17px); 
}

header .slider.round { 
  border-radius:34px; 
}

header .slider.round:before { 
  border-radius:50%; 
}

/* Hide mobile bits (desktop only) */
header .navbar .header__moblogo { 
  display:none; 
}

header .hdr__hamburger { 
  display:none; 
}

/* Οπτικός burger (3 γραμμές) */
.hdr__hamburger{
  position:relative;
  width: 28px;            /* πιο «τετράγωνο» */
  height: 24px;
  border: 2px solid var(--col-w);
  border-radius: .35rem;
  background: transparent;
  cursor:pointer;
  display: inline-block;
  box-sizing: border-box;
  vertical-align:middle;
  margin-left:.95rem; /* μικρό περιθώριο από αριστερά */
}

.hdr__hamburger::before{
  content:"";
  position:absolute;
  left:4px; right:4px;
  top:45%;                 /* μεσαία γραμμή */
  height:2px;
  background: var(--col-w);
  border-radius:2px;
  /* ζωγραφίζουμε και πάνω/κάτω με box-shadow → 3 γραμμές συνολικά */
  box-shadow: 0 -4.5px 0 0 var(--col-w), 0 4.5px 0 0 var(--col-w);
}
/* δεν χρειάζεται άλλο span/pseudo */


/* User button & avatar (όπως πριν, με μικρό padding για target >= 44px) */
.hdr__user { 
  position:relative; 
}

.hdr__userBtn {
  display:flex; 
  align-items:center; 
  gap:.4rem;
  background:transparent; 
  border:0; cursor:pointer;
  padding:.25rem;
}

.hdr__avatar {
  inline-size:36px;
  block-size:36px; 
  aspect-ratio:1/1;
  border-radius:50%; 
  object-fit:cover; 
  display:block;
  border:2px solid var(--col-l); 
  box-shadow:0 0 0 2px rgba(0,0,0,.1);
}

.hdr__caret {
  font-size:.9rem; 
  line-height:1; 
  margin-left:.35rem; 
  transform:translateY(-1px);
  color: var(--col-k);
}

/* Dropdown κρυφό by default */
.hdr__dropdown {
  position:absolute; 
  top:100%; right:0; 
  z-index:1300;
  display:none; 
  margin-top:.25rem; 
  min-width:14rem; 
  list-style:none; 
  padding:.25rem 0;
  background: var(--col-a); 
  color: var(--col-c);
  border:1px solid var(--col-r); 
  border-radius:.5rem;
  box-shadow:0 14px 30px rgba(0,0,0,.18);
}

/* ΑΝΟΙΓΕΙ όταν το κουμπί λέει aria-expanded="true" */
.hdr__userBtn[aria-expanded="true"] + .hdr__dropdown { 
  display: block; 
}

/* ΚΛΕΙΝΕΙ όταν aria-expanded="false" — υπερισχύει του :focus-within */
.hdr__userBtn[aria-expanded="false"] + .hdr__dropdown { 
  display: none; 
}

/* ΑΝΤΙΚΑΤΑΣΤΑΣΗ */
.hdr__userBtn[aria-expanded="true"] .hdr__caret {
  transform: translateY(-1px) rotate(180deg);
  transition: transform .15s;
}

/* Items */
.hdr__dropdown li + li{ 
  border-top:1px solid rgba(0,0,0,.06); 
}

.navbar .hdr__dropdown li a{
  display:block; 
  width:100%; 
  box-sizing:border-box;
  padding:1.15rem .8rem; 
  font-size:1.15rem; 
  line-height:1.3;
  color: var(--col-g); 
  text-decoration:none;
}

/* Hover & Focus (ευδιάκριτο) */
.navbar .hdr__dropdown li a:hover{ 
  background:#e9f7ee; 
  color: var(--col-g); 
}

/* ============================ */
/* Responsive Breakpoints       */
/* ============================ */
@media screen and (max-width: 95rem) { /* ή 1520px */
  header .main__width {
    display:grid;
    grid-template-columns: auto 1fr auto;
    align-items:center;
    gap:.75rem;
  }

  .hdr__hamburger{ margin-left:.85rem; } /* κρατάμε «ανάσα» από το αριστερό άκρο */

  header .header__logo{ 
    justify-self:center; 
    text-align:center; 
  }

  header .nav__items li a {
    color: var(--col-k);
    font-size: 1.25rem;
  }

  .mobile-panel .mobile-close{
    position: absolute;
    top: 1.35rem;
    left: 1.45rem; right: auto;       /* ⇦ πάει αριστερά */
    width: 28px; height: 28px;       /* ίδιο κουτί */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--col-w);
    border-radius: .45rem;
    background: transparent;
    color: var(--col-w);
    font-weight: 700;
    font-size: 1.25rem;              /* ΜΟΝΟ το “x” μεγαλώνει */
    line-height: 1;
    cursor: pointer;
  }

  .mobile-panel .mobile-close {
    top: 3rem;   /* κατεβαίνει πιο χαμηλά */
  }

  header .header__moblogo {
    margin-top: 4.2rem;  /* προσθέτει κενό κάτω από το close button */
  }

  #mobileUserMenu.hdr__dropdown {
    min-width: 16rem; /* πιο φαρδύ dropdown */
  }

  /* Avatar dropdown links μέσα στο mobile panel */
  #mobileUserMenu.hdr__dropdown li a {
    color: var(--col-b);
    padding-left: 1.2rem; /* extra αέρας αριστερά */
  }
}

@media screen and (max-width: 72rem) { /* ή 1152px */
  header { 
    z-index: 1000; 
  }

  header .main__width{
    display:grid;
    grid-template-columns: auto 1fr auto;
    align-items:center;
    gap:.75rem;
  }

  header .header__logo{ 
    justify-self:center; 
    text-align:center; 
  }

  header .navbar { display: none; }
  header .hdr__hamburger{ display:inline-block; margin-left:.95rem; }

  .mobile-overlay[hidden] { display:none; }
  .mobile-overlay {
    position:fixed; inset:0;
    background:rgba(0,0,0,.35);
    backdrop-filter:saturate(120%) blur(1px);
    z-index:900;
  }

  .mobile-panel[hidden] { display:none; }
  .mobile-panel {
    position: fixed;
    top: 0; left: 0; right: auto;     /* ⇦ αγκύρωση αριστερά */
    width: 80vw; max-width: 22rem;
    height: 100dvh;
    background: var(--col-b);
    padding: 2rem 1.5rem;
    box-shadow: 2px 0 12px rgba(0,0,0,.2);  /* σκιά από αριστερή πλευρά */
    transition: transform .45s ease;
    z-index: 1100;
    overflow: auto;
  }

  .mobile-panel ul, .mobile-panel li { list-style: none; margin: 0; padding: 0; }
  .mobile-panel li::marker { content: none; }

  .mobile-panel .mobile-menu{ display:block; margin:0; padding:0; list-style:none; }
  .mobile-panel .mobile-menu > li{ display:block; margin:0; padding:0; list-style:none; }
  .mobile-panel .mobile-menu > li + li{ margin-top:.3rem; }
  .mobile-panel .mobile-menu a{
    display:block;
    font-size:1.15rem;
    padding:.6rem .2rem;
    text-decoration:none;
    color: var(--col-k);
  }

  header .header__moblogo{
    display:flex; align-items:center; justify-content:space-between;
  }

  header .header__moblogo .moblogo__name{
    font-size:1.45rem; color:var(--col-n);
  }

  header .header__moblogo i{
    border-radius:.4rem;
    padding:.25rem .3rem .2rem;
    font-size:.875rem;
    color:var(--col-n);
    border:.15rem solid var(--col-n);
    cursor:pointer;
  }

  .hdr__dropdown{
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    transform: none;
    min-width: 12rem;
    width: max-content;
    max-width: calc(100vw - 1rem);
    z-index: 1300;
  }

  .navbar .hdr__dropdown li a{
    display:block;
    padding:.65rem 1.6rem .65rem 2.2rem;
    font-size:1.15rem;
    line-height:1.4;
    color: var(--col-g);
    text-decoration:none;
  }
}

@media screen and (max-width: 48rem) {/* ή 768px */
  header .main__width{
    display:grid;
    grid-template-columns: auto 1fr auto;
    align-items:center;
    gap:.75rem;
  }

  .hdr__hamburger{ 
    justify-self:start; 
    margin-left:.75rem;   /* επαναφέρουμε το περιθώριο */
  }

  header .header__logo{ 
    justify-self:center; 
    text-align:center; 
  }

  header .icons{ 
    justify-self:end; 
  }

  .mobile-panel{
    width: 78vw;
    max-width: 20rem;
    padding: 1.75rem 1.25rem;
  }

  .mobile-panel .mobile-menu a{
    font-size: 1.08rem;
  }

  .hdr__dropdown{
    top: 100%;
    right: 0;
    left: auto;
    transform: none;
    width: 16rem;
    min-width: 16rem;
    width: max-content;
    max-width: calc(100vw - 1rem);
    z-index: 1300;
  }

  .navbar .hdr__dropdown li a{
    padding: .65rem 1.6rem .65rem 1.8rem;
    line-height: 1.4;
  }
}

@media screen and (max-width: 37rem) {/* ή 592px */
  .mobile-panel{
    width: 86vw;
    max-width: 19rem;
    padding: 1.25rem 1rem;
  }

  .hdr__dropdown{
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    transform: none;
    width: 16rem;
    min-width: 16rem;
    max-width: calc(100vw - 1rem);
    z-index: 1300;
  }

  .mobile-panel .mobile-menu a {
    font-size: 0.98rem;
    padding: 0.72rem 1.6rem 0.72rem 1.4rem;
    line-height: 1.35;
  }
}

@media screen and (max-width: 30rem) {
  header {
    padding-inline: 0;
    box-sizing: border-box;
  }

  .mobile-panel{
    width: 90vw;
    max-width: 18rem;
    padding: 1rem .875rem;
  }

  .mobile-panel .mobile-menu a {
    font-size: 0.95rem;
  }

  header .header__moblogo .moblogo__name {
    font-size: 1.05rem;
  }

  .hdr__hamburger {
    justify-self: start;
  }

  header .header__logo {
    justify-self: center;
    text-align: center;
  }

  header .icons {
    justify-self: end;
  }
}

.sr-only {
  position:absolute; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}
