/* ============================================================
   PS News Panel v1.1 — newspanel.css
   Prefisso np- su tutti i selettori. Nessun reset globale.
   ============================================================ */

/* ============================================================
   VARIABILI — sovrascritte via style="" su #np-root
   ============================================================ */
#np-root {
  --np-bg:          #cc2200;
  --np-fg:          #ffffff;
  --np-hdr-bg:      #cc2200;
  --np-hdr-fg:      #ffffff;
  --np-panel-bg:    #ffffff;
  --np-panel-fg:    #333333;
  --np-panel-w:     340px;
  --np-z:           1500;
  --np-ease:        cubic-bezier(.4, 0, .2, 1);
  --np-speed:       .26s;
}

/* ============================================================
   BACKDROP
   ============================================================ */
.np-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: calc(var(--np-z) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--np-speed) var(--np-ease);
}
.np-backdrop.np-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   LINGUETTA LATERALE
   ============================================================ */
.np-tab {
  position: fixed;
  left: 0;
  top: 42%;
  transform: translateY(-50%);
  z-index: var(--np-z);

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  padding: 16px 9px;
  background: var(--np-bg);
  color: var(--np-fg);
  border: none;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  box-shadow: 3px 0 12px rgba(0, 0, 0, .22);

  transition:
    transform var(--np-speed) var(--np-ease),
    box-shadow var(--np-speed) var(--np-ease),
    background var(--np-speed) var(--np-ease);
}

.np-tab:hover {
  transform: translateY(-50%) translateX(4px);
  box-shadow: 5px 0 18px rgba(0, 0, 0, .3);
  filter: brightness(1.1);
}

.np-tab:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .7);
  outline-offset: -3px;
}

.np-tab[aria-expanded="true"] {
  transform: translateY(-50%) translateX(2px);
  box-shadow: 2px 0 8px rgba(0, 0, 0, .15);
  filter: brightness(.92);
}

/* Testo verticale */
.np-tab__label {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Badge numero news */
.np-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  background: #ffffff;
  color: var(--np-bg);
  border-radius: 11px;
  font-size: .65rem;
  font-weight: 900;
  line-height: 1;
  font-family: inherit;
  pointer-events: none;
}

/* ============================================================
   PANNELLO SLIDE
   ============================================================ */
.np-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--np-panel-w);
  max-width: 92vw;
  box-sizing: border-box;
  z-index: var(--np-z);

  display: flex;
  flex-direction: column;

  background: var(--np-panel-bg);
  color: var(--np-panel-fg);
  box-shadow: 6px 0 30px rgba(0, 0, 0, .22);

  transform: translateX(-100%);
  visibility: hidden;
  overflow: hidden;

  transition:
    transform var(--np-speed) var(--np-ease),
    visibility var(--np-speed);
}

.np-panel.np-open {
  transform: translateX(0);
  visibility: visible;
}

/* ---- Header ---- */
.np-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--np-hdr-bg);
  color: var(--np-hdr-fg);
  flex-shrink: 0;
  min-height: 60px;
}

.np-panel__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: inherit;
  line-height: 1.2;
}

/* Bottone chiudi */
.np-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  transition: background var(--np-speed) var(--np-ease);
}
.np-panel__close:hover {
  background: rgba(255, 255, 255, .32);
}
.np-panel__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .8);
  outline-offset: 2px;
}
.np-panel__close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
  pointer-events: none;
}

/* ---- Lista scrollabile ---- */
.np-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0 20px;
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .15) transparent;
}
.np-list::-webkit-scrollbar        { width: 4px; }
.np-list::-webkit-scrollbar-track  { background: transparent; }
.np-list::-webkit-scrollbar-thumb  { background: rgba(0, 0, 0, .15); border-radius: 4px; }

/* ---- Singolo item ---- */
.np-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  margin: 0;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  background: transparent;
  transition: background var(--np-speed) var(--np-ease);
}
.np-item:last-child {
  border-bottom: none;
}
.np-item:hover {
  background: rgba(0, 0, 0, .028);
}

/* Icone tipo */
.np-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  fill: currentColor;
  display: block;
}
.np-item--news  .np-icon { color: #1976d2; }
.np-item--alert .np-icon { color: #d32f2f; }
.np-item--promo .np-icon { color: #e65100; }
.np-item--info  .np-icon { color: #388e3c; }

/* Corpo item */
.np-item__body {
  flex: 1;
  min-width: 0;
}

.np-item__type {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  line-height: 1.5;
  color: #ffffff;
}
.np-item--news  .np-item__type { background: #1976d2; }
.np-item--alert .np-item__type { background: #d32f2f; }
.np-item--promo .np-item__type { background: #e65100; }
.np-item--info  .np-item__type { background: #388e3c; }

.np-item__text {
  margin: 0;
  padding: 0;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--np-panel-fg);
  word-break: break-word;
}

/* ============================================================
   RESPONSIVE — mobile
   ============================================================ */
@media (max-width: 600px) {
  #np-root,
  .np-root {
    --np-panel-w: auto;
  }

  .np-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    max-width: none;
  }

  .np-backdrop.np-visible {
    display: block;
  }

  .np-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    height: auto;
    box-sizing: border-box;
    transform: translateX(-100%);
  }

  .np-panel.np-open {
    transform: translateX(0);
  }

  .np-tab {
    padding: 12px 7px;
  }
  .np-tab__label {
    font-size: .62rem;
    letter-spacing: .1em;
  }
  .np-tab__badge {
    min-width: 18px;
    height: 18px;
    font-size: .6rem;
  }
  .np-panel__header {
    padding: 16px;
  }
  .np-item {
    padding: 14px 16px;
    gap: 12px;
  }
}
