:root {
  --bg: #0b0d10; 
  --fg: #e9edf1; 
  --muted: #aab4bf; 
  --card:#12161b; 
  --accent:#88e0a5; 
  --border:#1f242b;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  
  /* Mobile gradient colors - DARK MODE 
   * Gradiente UNICO che copre tutto il feed da cima a fondo
   * Molto più semplice ed elegante: un solo gradiente lungo per tutto il contenuto
   * - 0%: blu scuro (inizio del feed)
   * - 50%: transizione naturale 
   * - 100%: verde acqua (fine del feed)
   */
  --mobile-gradient: linear-gradient(
    to bottom,
    color-mix(in oklch, #1a1f3a, #2d4a7c 30%) 0%,
    color-mix(in oklch, #1a1f3a, #4a90a4 50%) 30%,
    color-mix(in oklch, #4a90a4, #5fb3ae 60%) 70%,
    color-mix(in oklch, #4a90a4, #5fb3ae 70%) 100%
  );
}

/* Mobile gradient colors - LIGHT MODE 
 * Stessa struttura del dark mode ma con colori chiari
 * 
 * 📖 GUIDA RAPIDA PER MODIFICARE I GRADIENTI:
 * 
 * 1️⃣ GRADIENTE SEMPLICE (nero→bianco dall'alto):
 *    --mobile-gradient: linear-gradient(to bottom, #000000, #ffffff);
 * 
 * 2️⃣ GRADIENTE DIAGONALE (rosso→blu):
 *    --mobile-gradient: linear-gradient(45deg, #ff0000, #0000ff);
 * 
 * 3️⃣ GRADIENTE RADIALE (centro→bordo):
 *    --mobile-gradient: radial-gradient(circle, #colore1, #colore2);
 * 
 * 4️⃣ GRADIENTE CON COLOR-MIX (automatico):
 *    --mobile-gradient: linear-gradient(to bottom, 
 *        color-mix(in oklch, #colore1, #colore2 30%), 
 *        color-mix(in oklch, #colore1, transparent 50%));
 * 
 * 🎨 DIREZIONI DISPONIBILI:
 * - to bottom (alto→basso) | to top (basso→alto)
 * - to right (sinistra→destra) | to left (destra→sinistra)  
 * - 45deg, 90deg, 135deg (angoli in gradi)
 */
@media (prefers-color-scheme: light) {
  :root {
    --mobile-gradient: linear-gradient(
      to bottom,
      color-mix(in oklch, #4a6fa5, #6b9dd6 40%) 0%,
      color-mix(in oklch, #6b9dd6, #7bc4c4 50%) 30%,
      color-mix(in oklch, #7bc4c4, #8cd8d4 60%) 70%,
      color-mix(in oklch, #7bc4c4, #8cd8d4 60%) 100%
    );
  }
}

* { 
  box-sizing: border-box; 
}

html, body { 
  height: 100%; 
}

body { 
  margin: 0; 
  background: var(--bg) url('/immagini/background2.jpg') center center fixed; 
  background-size: cover;
  color: var(--fg); 
  font-family: var(--font); 
  line-height: 1.55; 
  position: relative;
}

/* Mobile solid background */
@media (max-width: 768px) {
  body {
    background: none; /* Remove background from body */
    min-height: 100vh;
  }
  
  body::before {
    display: none; /* Remove overlay on mobile to show gradient */
  }
  
  /* Apply gradient from header to footer using pseudo-element */
  .wrap {
    position: relative;
    background: none;
    min-height: 100vh;
  }
  
  .wrap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mobile-gradient);
    z-index: -1;
    min-height: 100%;
  }
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  opacity: 0.3;
  z-index: -1;
}

.wrap { 
  max-width: 740px; 
  margin: 40px auto; 
  padding: 60px 16px 0; 
}

header { 
  display:flex; 
  align-items: center; 
  justify-content: center; 
  gap: 12px; 
  margin-bottom: 24px; 
  background: rgba(18, 22, 27, 0.85);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(10px);
}

h1 { 
  font-size: clamp(22px, 3.4vw, 36px); 
  margin: 0; 
  letter-spacing: -0.01em; 
}

/* Menu card for section selector */
.menu-card {
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: 16px; 
  padding: 16px; 
  margin-bottom: 24px;
  text-align: center;
}

/* Section selector dropdown */
.section-selector {
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 1rem;
  cursor: pointer;
  outline: none;
  text-align: center;
}

.section-selector:focus {
  border-color: var(--accent);
}

/* Content sections */
.content-section {
  display: none;
}

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

/* Live status card styling */
.live-status-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  margin-bottom: 24px;
}

.live-time {
  font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 12px;
  text-align: center;
}

/* Hospital days counter */
.hospital-days-counter {
  text-align: center;
  margin: 16px 0;
  padding: 16px;
  background: rgba(136, 224, 165, 0.1);
  border: 1px solid rgba(136, 224, 165, 0.3);
  border-radius: 12px;
}

.hospital-days-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font);
  line-height: 1;
  margin-bottom: 6px;
}

.hospital-days-label {
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* Countdown widget */
.countdown-widget {
  text-align: center;
  margin: 16px 0;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.1));
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.countdown-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: countdown-shimmer 3s infinite;
}

@keyframes countdown-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.countdown-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ff9500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.countdown-timer {
  font-size: 2rem;
  font-weight: 700;
  color: #ff9500;
  font-family: var(--font);
  line-height: 1;
  margin: 12px 0;
  text-shadow: 0 0 10px rgba(255, 149, 0, 0.3);
}

.countdown-description {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 8px;
}

.status-section {
  margin: 16px 0;
}

.status-section h4 {
  color: var(--fg);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.status-section p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

/* Hospital info card styling */
.hospital-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  margin-bottom: 24px;
}

.hospital-info {
  line-height: 1.6;
}

.hospital-info h4 {
  color: var(--fg);
  font-size: 1.1rem;
  margin: 0 0 12px 0;
}

.hospital-info p {
  color: var(--muted);
  margin: 6px 0;
}

.not-hospitalized {
  text-align: center;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 500;
}

/* Visiting hours section */
.visiting-hours {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.visiting-hours h4 {
  color: var(--accent);
  font-weight: 400;
  margin-bottom: 12px;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.visiting-hours p {
  margin: 8px 0;
  color: var(--secondary);
  font-size: 0.95rem;
}

.visiting-hours strong {
  color: var(--text);
  font-weight: 500;
}

/* Section title styling (Updates) */
.section-title {
  margin: 0;
  font-size: 1.2rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
}

/* Main title styling (topbar) */
.main-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;
  font-weight: 300;
  letter-spacing: 2px;
  font-size: 0.85rem;
  color: var(--accent);
}

.desc { 
  color: var(--muted); 
  font-size: 0.98rem; 
  margin: 0 0 8px 0;
}

.desc:first-child {
  margin-top: 0;
}

.desc-list {
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0 0 0 0;
  padding-left: 20px;
}

.desc-list li {
  margin: 4px 0;
  line-height: 1.4;
}

.desc-list li strong {
  color: var(--fg);
}

.card { 
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: 16px; 
  padding: 18px 18px; 
}

.post { 
  border: 1px solid var(--border); 
  border-radius: 14px; 
  padding: 16px; 
  background: #0d1116; 
  --card-accent: rgba(255,255,255,0.04);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.post + .post { 
  margin-top: 36px; 
}

.post-header {
  background: var(--card-accent, rgba(0,0,0,0.02));
  margin: -16px -16px 16px -16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
}

.post h3 { 
  margin: 0 0 8px; 
  font-size: 1.2rem; 
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.meta { 
  display:flex; 
  gap:10px; 
  align-items:center; 
  color: var(--muted); 
  font-size: 0.9rem; 
}

.badge { 
  padding: 2px 8px; 
  border-radius: 999px; 
  border: 1px solid var(--border); 
  background: #0b0f14; 
  font-size: 0.75rem; 
  color: var(--muted); 
}

/* Badge colors by location */
.badge-casetta {
  background: #16a34a;
  border-color: #22c55e;
  color: #dcfce7;
}

.badge-pronto-soccorso {
  background: #ea580c;
  border-color: #f97316;
  color: #fed7aa;
}

.badge-ospedale {
  background: #dc2626;
  border-color: #ef4444;
  color: #fecaca;
}

.badge-milano {
  background: #7c3aed;
  border-color: #8b5cf6;
  color: #e4d4f4;
}

.badge-dimesso {
  background: #0891b2;
  border-color: #06b6d4;
  color: #cffafe;
}

.badge-aggiunto-dopo {
  background: #4b5563;
  border-color: #6b7280;
  color: #d1d5db;
}

.content { 
  margin-top: 10px; 
  white-space: pre-wrap; 
  word-wrap: break-word; 
  font-size: 0.95rem; 
  line-height: 1.5;
  color: var(--muted);
}

/* Comments system */
.comments-section {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.comments-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  transition: color 0.2s ease;
}

.comments-toggle:hover {
  color: var(--fg);
}

.comments-toggle span:last-child {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.comments-container {
  margin-top: 12px;
}

.comment {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0;
  font-size: 0.9rem;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.comment-author {
  font-weight: 600;
  color: var(--accent);
}

.comment-text {
  line-height: 1.4;
  word-wrap: break-word;
}

.comment-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.comment-form input::placeholder,
.comment-form textarea::placeholder {
  color: var(--muted);
}

.comment-form textarea {
  resize: vertical;
  min-height: 60px;
  margin: 8px 0;
}

.comment-form button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.comment-form button:hover {
  opacity: 0.8;
}

.comment-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comments-collapsed {
  display: none;
}


footer { 
  margin: 32px 0 60px; 
  color: var(--muted); 
  font-size: 0.9rem; 
  text-align: center; 
}

.topbar { 
  position: fixed; 
  top: 0; 
  left: 0;
  right: 0;
  backdrop-filter: blur(10px); 
  background: color-mix(in oklab, var(--bg) 85%, transparent); 
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.topbar .inner { 
  max-width: 740px; 
  margin: 0 auto; 
  padding: 10px 16px; 
  display:flex; 
  justify-content: center; 
  align-items:center; 
}

.btn { 
  appearance:none; 
  border:1px solid var(--border); 
  background:#0f141a; 
  color:var(--fg); 
  padding:8px 12px; 
  border-radius:12px; 
  font-size:0.9rem; 
  cursor:pointer; 
}

.btn:hover { 
  border-color:#27303a; 
}

a { 
  color: var(--accent); 
  text-decoration: none; 
}

a:hover { 
  text-decoration: underline; 
}

/* Prevent text selection and right-click context menu */
* {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

/* Light mode support */
@media (prefers-color-scheme: light) {
  :root { 
    --bg:#f8fafc; 
    --fg:#0e1116; 
    --muted:#52606d; 
    --card:#ffffff; 
    --border:#e5e9ef; 
    --accent:#0ea5e9; 
    
  }
  
  .post { 
    background: #fff; 
    --card-accent: rgba(0,0,0,0.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  
  .menu-card, .live-status-card, .hospital-card {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  
  .section-selector {
    background: #fff;
  }
  
  .topbar { 
    background: color-mix(in oklab, var(--bg) 85%, transparent);
  }
  
  .btn { 
    background:#fff; 
  }
  
  /* Badge colors for light mode */
  .badge-casetta {
    background: #22c55e;
    border-color: #16a34a;
    color: #14532d;
  }

  .badge-pronto-soccorso {
    background: #f97316;
    border-color: #ea580c;
    color: #9a3412;
  }

  .badge-ospedale {
    background: #ef4444;
    border-color: #dc2626;
    color: #991b1b;
  }

  .badge-milano {
    background: #8b5cf6;
    border-color: #7c3aed;
    color: #5b21b6;
  }

  .badge-dimesso {
    background: #06b6d4;
    border-color: #0891b2;
    color: #164e63;
  }

  .badge-aggiunto-dopo {
    background: #6b7280;
    border-color: #4b5563;
    color: #374151;
  }
  
  /* Comments light mode */
  .comment {
    background: #f9fafb;
  }
  
  /* Background overlay for light mode */
  body::before {
    background: var(--bg);
    opacity: 0.4;
  }
  
  /* Header light mode */
  header {
    background: rgba(255, 255, 255, 0.90);
  }
  
  /* Mobile background for light mode */
  @media (max-width: 768px) {
    body {
      background: none; /* Remove background from body */
    }
    
    body::before {
      display: none; /* Remove overlay on mobile to show gradient */
    }
    
    /* Apply gradient from header to footer for light mode */
    .wrap::before {
      background: var(--mobile-gradient);
    }
  }
}
