/* Palette ispirata al logo Rocket TV: navy, cyan, rosso, giallo oro, bianco */
:root {
  --navy-950: #050a14;
  --navy-900: #0a1628;
  --navy-800: #0f2744;
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;
  --cyan-600: #0891b2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --gold-300: #fde047;
  --gold-400: #facc15;
  --gold-500: #eab308;
  --white: #f8fafc;
  --muted: #94a3b8;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-glow: 0 0 40px rgba(34, 211, 238, 0.12);
  --font: "Montserrat", system-ui, -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--white);
  background: radial-gradient(1200px 800px at 10% -10%, rgba(6, 182, 212, 0.18), transparent 55%),
    radial-gradient(900px 600px at 100% 20%, rgba(239, 68, 68, 0.1), transparent 50%),
    linear-gradient(165deg, var(--navy-950) 0%, var(--navy-900) 40%, #0c1a30 100%);
  -webkit-font-smoothing: antialiased;
}

.stars {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1.5px 1.5px at 65% 18%, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1px 1px at 80% 70%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(2px 2px at 40% 85%, rgba(253, 224, 71, 0.2), transparent);
  opacity: 0.5;
  z-index: 0;
}

.app-root {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: max(1rem, var(--safe-bottom));
}

/* —— Shell —— */
.shell {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: calc(100dvh - 2rem);
}

.shell-top {
  position: sticky;
  top: 0;
  z-index: 25;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: rgba(5, 10, 20, 0.35);
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.shell-header {
  padding: 0 0 0.55rem;
  margin: 0;
  background: transparent;
  border: none;
  backdrop-filter: none;
}

.shell-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid rgba(34, 211, 238, 0.45);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-text p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan-400), var(--cyan-600));
  color: var(--navy-950);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(34, 211, 238, 0.45);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  color: var(--navy-950);
}

.btn-ghost {
  background: rgba(15, 39, 68, 0.6);
  color: var(--cyan-400);
  border: 1px solid rgba(34, 211, 238, 0.35);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

/* —— Cards & layout —— */
.grid-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background: linear-gradient(145deg, rgba(15, 39, 68, 0.75), rgba(10, 22, 40, 0.9));
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-glow);
}

.card h2,
.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--white);
}

.card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge.public {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan-400);
  border-color: rgba(34, 211, 238, 0.35);
}

/* —— Articles —— */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.article-link {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(5, 10, 20, 0.35);
  border: 1px solid rgba(250, 204, 21, 0.12);
  color: var(--gold-300);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font);
  transition: border-color 0.2s, background 0.2s;
}

.article-link:hover {
  border-color: rgba(250, 204, 21, 0.45);
  background: rgba(250, 204, 21, 0.06);
}

.article-prose {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #e2e8f0;
}

.article-prose p {
  margin: 0 0 0.75rem;
}

.home-welcome .home-lead p:last-child {
  margin-bottom: 0;
}

.home-block-img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-top: 0.35rem;
  border: 1px solid rgba(34, 211, 238, 0.15);
}

.home-video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  margin-top: 0.35rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: rgba(5, 10, 20, 0.5);
}

.home-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* —— Files —— */
.files {
  list-style: none;
  padding: 0;
  margin: 0.65rem 0 0;
}

.files li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

/* —— Forms —— */
input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: rgba(5, 10, 20, 0.65);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  font-family: var(--font);
  font-size: 0.9rem;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: block;
  margin-bottom: 0.25rem;
}

.form-grid {
  display: grid;
  gap: 0.55rem;
}

.err {
  color: #fecaca;
  font-size: 0.85rem;
  min-height: 1.1rem;
}

/* —— Admin login —— */
.admin-login-wrap {
  max-width: 420px;
  margin: 2rem auto;
}

/* —— Admin layout —— */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.admin-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-tab {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(15, 39, 68, 0.5);
  color: var(--muted);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.admin-tab:hover {
  color: var(--cyan-400);
}

.admin-tab.active {
  color: var(--navy-950);
  background: linear-gradient(135deg, var(--cyan-400), var(--cyan-500));
  border-color: rgba(255, 255, 255, 0.2);
}

.admin-panel {
  display: none;
}

.admin-panel.visible {
  display: block;
}

/* —— Modal —— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 10, 20, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, var(--safe-bottom));
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal {
  width: 100%;
  max-width: 640px;
  max-height: min(88vh, 900px);
  overflow: auto;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

/* —— Public nav (Home / Community / Admin) —— visibile su tutte le larghezze —— */
.public-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.35rem 0 0;
  margin: 0;
  border-top: 1px solid rgba(34, 211, 238, 0.12);
  background: transparent;
}

.public-nav button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(5, 10, 20, 0.25);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  cursor: pointer;
  padding: 0.35rem 0.25rem;
}

.public-nav button svg {
  width: 22px;
  height: 22px;
  opacity: 0.75;
  flex-shrink: 0;
}

.public-nav button.active {
  color: var(--cyan-400);
  background: rgba(34, 211, 238, 0.1);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.25);
}

.public-nav button.active svg {
  opacity: 1;
}

@media (min-width: 720px) {
  .public-nav {
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
    padding-top: 0.5rem;
  }

  .public-nav button {
    flex: 0 1 200px;
    flex-direction: row;
    font-size: 0.8rem;
    gap: 0.45rem;
  }
}

.shell-views {
  flex: 1;
  min-height: 0;
}

.section-view {
  display: none;
}

.section-view.active {
  display: block;
}

.inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.25), transparent);
  margin: 1.25rem 0;
}

.hidden {
  display: none !important;
}
