/* ============================================
   ESPAI DE LECTURA — Aside Menu & Activitats
============================================ */

/* ==============================
   ASIDE / SIDEBAR
============================== */

.sidebar {
  width: 275px;
  flex-shrink: 0;
  background: var(--white);
  box-shadow: 4px 0 24px rgba(0,0,0,.07);
  padding: 2rem 1.4rem 3rem;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 3px solid;
}
#quart .sidebar-brand { border-color: var(--teal); }
#sise  .sidebar-brand { border-color: var(--blue); }

.sidebar-brand svg { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-brand-text {
  font-family: var(--font-h);
  font-size: 1.25rem;
  line-height: 1.2;
}
#quart .sidebar-brand-text { color: var(--teal); }
#sise  .sidebar-brand-text { color: var(--blue); }

/* Grup del menú (categoria + fills) */
.menu-group { margin-bottom: .5rem; }

.menu-cat {
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  font-family: var(--font-h);
  font-size: .98rem;
  padding: .7rem 1rem;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .2s ease, color .2s ease;
}
#quart .menu-cat { background: rgba(6,201,148,.1);  color: #05a07a; }
#quart .menu-cat:hover { background: rgba(6,201,148,.2); }
#sise  .menu-cat { background: rgba(17,138,178,.1); color: var(--blue); }
#sise  .menu-cat:hover { background: rgba(17,138,178,.2); }

.menu-cat .cat-arrow {
  margin-left: auto;
  font-size: .75rem;
  transition: transform .3s ease;
  flex-shrink: 0;
}
.menu-cat.open .cat-arrow { transform: rotate(180deg); }

.menu-cat .cat-icon { font-size: 1rem; flex-shrink: 0; }

/* Fills */
.menu-kids {
  list-style: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height .45s cubic-bezier(.16,1,.3,1), opacity .3s ease;
  opacity: 0;
  padding-left: .4rem;
}
.menu-kids.open { max-height: 400px; opacity: 1; }

.menu-kids li { margin: .25rem 0; }

.menu-child {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-b);
  font-weight: 600;
  font-size: .85rem;
  padding: .5rem .9rem .5rem 1.1rem;
  border-radius: 10px;
  color: #777;
  display: flex;
  align-items: center;
  gap: .55rem;
  transition: all .2s ease;
}
.menu-child::before {
  content: '›';
  font-size: 1rem;
  opacity: .5;
  transition: opacity .2s, transform .2s;
  flex-shrink: 0;
}
.menu-child:hover { background: rgba(0,0,0,.04); color: var(--navy); }
.menu-child:hover::before { opacity: 1; transform: translateX(3px); }

.menu-child.active {
  font-weight: 800;
  color: var(--white);
}
.menu-child.active::before { opacity: 1; }
#quart .menu-child.active { background: var(--teal); }
#sise  .menu-child.active { background: var(--blue); }

/* ==============================
   ZONA DE CONTINGUT
============================== */

.content-area {
  flex: 1;
  padding: 2.5rem 3rem;
  overflow-y: auto;
}

/* Pantalla de benvinguda */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  text-align: center;
  gap: 1.4rem;
  padding: 3rem 1rem;
}
.welcome-icon {
  font-size: 5rem;
  line-height: 1;
  animation: bounceIcon 2.4s ease-in-out infinite;
}
@keyframes bounceIcon {
  0%,100% { transform: translateY(0) rotate(-5deg); }
  50%     { transform: translateY(-18px) rotate(5deg); }
}
.welcome-screen h2 {
  font-family: var(--font-h);
  font-size: 2.1rem;
  line-height: 1.2;
}
#quart .welcome-screen h2 { color: var(--teal); }
#sise  .welcome-screen h2 { color: var(--blue); }
.welcome-screen p { font-size: 1.05rem; color: #999; max-width: 380px; line-height: 1.6; }

/* ---- Capçalera d'activitat ---- */
.act-header { margin-bottom: 2rem; }

.act-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .3rem .85rem;
  border-radius: 100px;
  margin-bottom: .8rem;
}
.badge-lectura    { background: rgba(17,138,178,.12); color: var(--blue); }
.badge-escriptura { background: rgba(6,201,148,.12);  color: #059a76; }

.act-title {
  font-family: var(--font-h);
  font-size: 2.2rem;
  line-height: 1.2;
  margin-bottom: .5rem;
}
#quart .act-title { color: var(--coral); }
#sise  .act-title { color: var(--blue); }

.act-intro {
  font-size: 1rem;
  color: #777;
  line-height: 1.75;
  max-width: 660px;
}

/* ---- Blocs d'activitat ---- */
.act-block {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--s-sm);
  transition: transform .25s ease, box-shadow .25s ease;
}
.act-block:hover { transform: translateY(-3px); box-shadow: var(--s-md); }

.block-title {
  font-family: var(--font-h);
  font-size: 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
#quart .block-title { color: var(--teal); }
#sise  .block-title { color: var(--blue); }

/* Text de lectura */
.reading-text {
  background: #fafafa;
  border-left: 5px solid var(--yellow);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 1.1rem 1.5rem;
  font-size: .94rem;
  line-height: 1.85;
  color: #555;
  font-style: italic;
  margin-bottom: .75rem;
}

/* Preguntes */
.q-list { list-style: none; display: flex; flex-direction: column; gap: .65rem; }
.q-item {
  background: var(--cream);
  border-radius: var(--r-sm);
  padding: .85rem 1.1rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}
.q-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 900;
  color: var(--white);
  flex-shrink: 0;
}
#quart .q-num { background: var(--teal); }
#sise  .q-num { background: var(--blue); }

/* Àrea d'escriptura (línies) */
.writing-area {
  background: repeating-linear-gradient(transparent, transparent 31px, #e4e4e4 31px, #e4e4e4 32px);
  border: 2px solid #ddd;
  border-radius: var(--r-sm);
  min-height: 130px;
  padding: 10px 1rem;
  font-family: var(--font-b);
  font-size: .95rem;
  resize: vertical;
  width: 100%;
  outline: none;
  line-height: 32px;
  color: var(--navy);
  transition: border-color .2s ease, box-shadow .2s ease;
}
#quart .writing-area:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(6,201,148,.18); }
#sise  .writing-area:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17,138,178,.18); }

/* Caixa de consell */
.tip-box {
  background: linear-gradient(135deg, #fff9f0, #fff4f8);
  border: 2px solid var(--yellow);
  border-radius: var(--r-md);
  padding: 1.1rem 1.4rem;
  font-size: .88rem;
  color: #666;
  line-height: 1.65;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.tip-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: .1rem; }

/* Graella de vocabulari */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: .55rem;
}
.vocab-item {
  background: var(--cream);
  border-radius: 10px;
  padding: .5rem .8rem;
  font-size: .82rem;
  font-weight: 700;
  text-align: center;
  color: var(--navy);
  border: 2px solid transparent;
}
#quart .vocab-item { border-color: rgba(6,201,148,.3); }
#sise  .vocab-item { border-color: rgba(17,138,178,.3); }

/* Plantilla de postal */
.postcard {
  border: 3px dashed var(--yellow);
  border-radius: var(--r-md);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 1.5rem;
  background: #fff9f0;
}
.postcard-divider { background: #ddd; }
.postcard-label {
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: .5rem;
}
.postcard-lines { display: flex; flex-direction: column; gap: .6rem; }
.postcard-line  { height: 2px; background: #e0e0e0; border-radius: 2px; }

/* Graella per a l'animal */
.animal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.animal-field {
  background: var(--cream);
  border-radius: var(--r-sm);
  padding: .7rem 1rem;
}
.animal-field label {
  display: block;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: .35rem;
}
.animal-field input {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 2px solid #ddd;
  font-family: var(--font-b);
  font-size: .88rem;
  color: var(--navy);
  padding: .2rem 0;
  outline: none;
}
#quart .animal-field input:focus { border-color: var(--teal); }
#sise  .animal-field input:focus { border-color: var(--blue); }

/* Titular periodístic */
.newspaper-struct {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.news-part {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
}
.news-part-label {
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--blue);
  padding: .25rem .6rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: .3rem;
}
.news-part p { font-size: .9rem; color: #666; line-height: 1.6; }

/* Titulars fake/real */
.headlines-grid { display: flex; flex-direction: column; gap: .7rem; }
.headline-item {
  background: var(--cream);
  border-radius: var(--r-sm);
  padding: .85rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--navy);
  cursor: default;
}
.hl-tag {
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .25rem .7rem;
  border-radius: 100px;
  flex-shrink: 0;
}
.hl-tag.real { background: rgba(6,201,148,.15); color: #059a76; }
.hl-tag.fake { background: rgba(239,71,111,.12); color: var(--coral); }

/* Escape room clues */
.clue-list { display: flex; flex-direction: column; gap: .8rem; }
.clue-item {
  background: linear-gradient(135deg, #f0f6ff, #f5f0ff);
  border-radius: var(--r-sm);
  padding: 1rem 1.2rem;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.clue-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-family: var(--font-h);
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.clue-text { font-size: .88rem; line-height: 1.65; color: #555; }
.clue-quote { font-style: italic; font-weight: 700; color: var(--blue); }

/* Debate */
.debate-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.debate-col h4 {
  font-family: var(--font-h);
  font-size: 1rem;
  margin-bottom: .6rem;
  padding: .4rem .8rem;
  border-radius: var(--r-sm);
}
.debate-col.pro h4 { background: rgba(6,201,148,.12); color: #059a76; }
.debate-col.con h4 { background: rgba(239,71,111,.12); color: var(--coral); }

/* ==============================
   PROGRAMACIÓ DIDÀCTICA — apartats
============================== */
.plan-text {
  font-size: .95rem;
  line-height: 1.7;
  color: #555;
}
.plan-text + .plan-text { margin-top: .85rem; }

.plan-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.plan-list li {
  position: relative;
  padding: .55rem .9rem .55rem 2.1rem;
  background: var(--cream);
  border-radius: var(--r-sm);
  font-size: .92rem;
  line-height: 1.55;
  color: var(--navy);
}
.plan-list li::before {
  content: '';
  position: absolute;
  left: .95rem;
  top: 1.05rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
#quart .plan-list li::before { background: var(--teal); }
#sise  .plan-list li::before { background: var(--blue); }

.plan-subtitle {
  font-family: var(--font-h);
  font-size: 1rem;
  margin: 1.2rem 0 .6rem;
  padding-left: .6rem;
  border-left: 4px solid;
  border-radius: 2px;
}
.plan-subtitle:first-of-type { margin-top: .4rem; }
#quart .plan-subtitle { color: var(--teal); border-color: var(--teal); }
#sise  .plan-subtitle { color: var(--blue); border-color: var(--blue); }

/* ==============================
   PROMPT D'IA — Desplegable sota el títol
============================== */
.prompt-box {
  margin-bottom: 1.8rem;
}
.prompt-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-h);
  font-size: .92rem;
  padding: .55rem 1rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background .2s, color .2s, box-shadow .2s;
}
.prompt-toggle::-webkit-details-marker { display: none; }
.prompt-toggle::after {
  content: '▾';
  font-size: .8rem;
  transition: transform .25s ease;
}
.prompt-box[open] .prompt-toggle::after { transform: rotate(180deg); }

#quart .prompt-toggle { background: rgba(6,201,148,.12); color: var(--teal); }
#sise  .prompt-toggle { background: rgba(17,138,178,.12); color: var(--blue); }
#quart .prompt-toggle:hover { background: rgba(6,201,148,.2); }
#sise  .prompt-toggle:hover { background: rgba(17,138,178,.2); }

.prompt-content {
  margin-top: .75rem;
  padding: 1rem 1.2rem;
  background: var(--cream);
  border-left: 4px solid;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: .9rem;
  font-style: italic;
  line-height: 1.65;
  color: #555;
  animation: promptFade .25s ease;
}
#quart .prompt-content { border-color: var(--teal); }
#sise  .prompt-content { border-color: var(--blue); }
@keyframes promptFade { from { opacity: 0; } to { opacity: 1; } }

/* ==============================
   SIDEBAR DRAWER — Hamburger + Overlay
   (oculto por defecto; activo en ≤1024px)
============================== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 84px;
  left: 14px;
  z-index: 280;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 6px 22px rgba(0,0,0,.16);
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.sidebar-toggle:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(0,0,0,.22); }

.sidebar-toggle span {
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 3px;
  background: var(--navy);
  transition: transform .3s cubic-bezier(.16,1,.3,1), opacity .25s ease, background .25s ease;
  transform-origin: center;
}
#quart .sidebar-toggle span { background: var(--teal); }
#sise  .sidebar-toggle span { background: var(--blue); }

.sidebar-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.sidebar-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.sidebar-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7,59,76,.55);
  backdrop-filter: blur(2px);
  z-index: 255;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

.sidebar-close {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.06);
  color: var(--navy);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, transform .2s ease;
  z-index: 5;
}
.sidebar-close:hover { background: rgba(0,0,0,.12); transform: rotate(90deg); }

/* ==============================
   RESPONSIVE — Tablet (≤1024px)
   Activa el drawer
============================== */
@media (max-width: 1024px) {
  .sidebar-toggle { display: flex; }
  .sidebar-overlay { display: block; }
  .sidebar-close { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(85vw, 320px);
    transform: translateX(-100%);
    transition: transform .35s cubic-bezier(.16,1,.3,1);
    z-index: 260;
    box-shadow: 6px 0 32px rgba(0,0,0,.22);
    padding-top: 3.5rem;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); padding-top: 150px; }

  .content-area {
    width: 100%;
    padding: 5rem 2rem 3rem;
  }
}

/* ==============================
   RESPONSIVE — Móvil (≤768px)
============================== */
@media (max-width: 768px) {
  .sidebar-toggle { top: 76px; left: 10px; width: 42px; height: 42px; border-radius: 12px; }

  .content-area { padding: 4.5rem 1.4rem 2.5rem; }

  .welcome-screen { min-height: 360px; padding: 2rem .5rem; gap: 1rem; }
  .welcome-icon { font-size: clamp(3.5rem, 13vw, 5rem); }
  .welcome-screen h2 { font-size: clamp(1.6rem, 6vw, 2.1rem); }
  .welcome-screen p { font-size: .96rem; }

  .act-title { font-size: clamp(1.5rem, 6vw, 2.2rem); }
  .act-intro { font-size: .95rem; }

  .act-block { padding: 1.3rem 1.2rem; border-radius: var(--r-md); }
  .block-title { font-size: 1.05rem; }

  .debate-cols { grid-template-columns: 1fr; gap: .9rem; }
  .postcard { grid-template-columns: 1fr; gap: 1rem; padding: 1.2rem; }
  .postcard-divider { display: none; }
  .animal-grid { grid-template-columns: 1fr; }

  .news-part { flex-direction: column; gap: .35rem; }
  .news-part-label { align-self: flex-start; margin-top: 0; }

  .headline-item { flex-direction: column; align-items: flex-start; gap: .5rem; }

  .reading-text { padding: 1rem 1.2rem; font-size: .92rem; line-height: 1.75; }

  .vocab-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
}

/* ==============================
   RESPONSIVE — Móvil pequeño (≤480px)
============================== */
@media (max-width: 480px) {
  .sidebar-toggle { top: 70px; left: 8px; width: 40px; height: 40px; }
  .sidebar-toggle span { width: 19px; height: 2.5px; }
  .sidebar-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .sidebar-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .content-area { padding: 4rem 1rem 2rem; }

  .act-block { padding: 1.1rem .95rem; }
  .reading-text { padding: .85rem 1rem; font-size: .9rem; }
  .q-item { padding: .75rem .9rem; font-size: .86rem; }
  .tip-box { padding: .95rem 1rem; font-size: .85rem; }
  .clue-item { padding: .85rem 1rem; }

  .vocab-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
  .vocab-item { font-size: .78rem; padding: .45rem .7rem; }

  .sidebar { width: min(90vw, 300px); padding: 3rem 1.1rem 2rem; }
  .sidebar-brand-text { font-size: 1.1rem; }
  .menu-cat { font-size: .92rem; padding: .65rem .85rem; }
  .menu-child { font-size: .82rem; padding: .45rem .8rem .45rem 1rem; }
}
