/* Masthead brand */
.masthead-brand {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: 1.9rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #f0f0f0 !important;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  padding: 0.1rem 0.6rem 0.1rem 0;
  border-right: 2px solid #444;
  margin-right: 0.25rem;
}
.masthead-brand:hover { color: #e6a817 !important; }
[data-bs-theme="light"] .masthead-brand { color: #111 !important; border-right-color: #ccc; }
[data-bs-theme="light"] .masthead-brand:hover { color: #c8860a !important; }

/* Page loader */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#page-loader.active {
  opacity: 1;
  pointer-events: all;
}
#page-loader-bar {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #e6a817, #f5d06a, #e6a817);
  background-size: 200% 100%;
  animation: loader-shimmer 1.2s linear infinite;
  box-shadow: 0 0 8px #e6a81788;
}
@keyframes loader-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
#page-loader-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  color: #e6a817;
  opacity: 0;
  transition: opacity 0.3s 0.4s;
  animation: loader-pulse 1s ease-in-out infinite;
}
#page-loader.active #page-loader-icon {
  opacity: 0.7;
}
@keyframes loader-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.5; }
  50%       { transform: translate(-50%, -50%) scale(1.15); opacity: 0.9; }
}

/* Sidebar */
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: #444 #1a1a1a;
}

/* Article cards */
.article-card {
  transition: border-color 0.15s;
}
.article-card.unread {
  border-left: 3px solid #ffc107 !important;
}
.article-card:hover {
  border-color: #6c757d !important;
}

.article-title {
  color: #e0e0e0;
}
.article-card.unread .article-title {
  color: #ffffff;
}
.article-card:not(.unread) .article-title {
  color: #8a9ba8;
}

.article-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-badge {
  font-size: 0.7rem;
  white-space: nowrap;
}

/* Badge comuni */
.comune-badge {
  font-size: 0.7rem;
  background-color: #1a472a;
  color: #a3d9a5;
  border: 1px solid #2d6a4f;
  transition: background-color 0.15s;
}
.comune-badge:hover {
  background-color: #2d6a4f;
  color: #d8f3dc;
}
.comune-badge.badge-active {
  background-color: #2d6a4f;
  color: #d8f3dc;
}
.badge-inactive {
  background-color: #343a40;
  color: #adb5bd;
}
.badge-active {
  background-color: #495057;
  color: #ffffff;
}

/* Tabella pivot */
.pivot-table {
  font-size: 0.78rem;
  border-color: #2d3238 !important;
}
.pivot-table th {
  background: #1a1d20;      /* dark mode */
  white-space: nowrap;
  font-weight: 500;
  vertical-align: middle;
  border-color: #2d3238 !important;
}
[data-bs-theme="light"] .pivot-table th {
  background: #f1f3f5 !important;
  color: #212529;
}
.pivot-table th .comune-badge {
  font-size: 0.7rem;
}
.pivot-day-col {
  min-width: 80px;
  white-space: nowrap;
}
.pivot-cell {
  min-width: 36px;
  border-color: #2d3238 !important;
}
.pivot-active {
  background-color: rgba(45, 106, 79, 0.25);
}
.pivot-active a {
  color: #a3d9a5;
}

/* Separatore data */
.date-separator {
  display: flex;
  align-items: center;
  margin: 1rem 0 0.5rem;
  gap: 0.75rem;
  color: #adb5bd;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.date-separator::before,
.date-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #343a40;
}

/* Overflow fix */
.min-w-0 { min-width: 0; }
.overflow-y-auto { overflow-y: auto; }

/* ── Tema chiaro ── */
[data-bs-theme="light"] .article-title,
[data-bs-theme="light"] .article-card.unread .article-title,
[data-bs-theme="light"] a.article-title,
[data-bs-theme="light"] a.article-title:visited { color: #212529 !important; }
[data-bs-theme="light"] .article-card:not(.unread) .article-title { color: #495057 !important; }
[data-bs-theme="light"] .article-card:hover { border-color: #adb5bd !important; }

[data-bs-theme="light"] .comune-badge {
  background-color: #d8f3dc;
  color: #1a472a;
  border-color: #a3d9a5;
}
[data-bs-theme="light"] .comune-badge:hover,
[data-bs-theme="light"] .comune-badge.badge-active {
  background-color: #a3d9a5;
  color: #1a472a;
}
[data-bs-theme="light"] .badge-inactive { background-color: #e9ecef; color: #495057; }
[data-bs-theme="light"] .badge-active   { background-color: #dee2e6; color: #212529; }

[data-bs-theme="light"] .pivot-table       { border-color: #dee2e6 !important; }
[data-bs-theme="light"] .pivot-table th    { background: #f8f9fa; border-color: #dee2e6 !important; }
[data-bs-theme="light"] .pivot-cell        { border-color: #dee2e6 !important; }
[data-bs-theme="light"] .pivot-active      { background-color: rgba(163,217,165,0.35); }
[data-bs-theme="light"] .pivot-active a    { color: #1a472a; }

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: baseline; }
.tag-cloud a { text-decoration: none; color: #bbb; transition: color 0.15s; line-height: 1.4; }
.tag-cloud a:hover { color: #e6a817; }
.tc-1 { font-size: 0.78rem !important; opacity: 0.55; }
.tc-2 { font-size: 1.05rem !important; opacity: 0.68; }
.tc-3 { font-size: 1.38rem !important; opacity: 0.82; }
.tc-4 { font-size: 1.72rem !important; opacity: 0.93; }
.tc-5 { font-size: 2.1rem  !important; opacity: 1; font-weight: 600; }

[data-bs-theme="light"] .tag-cloud a { color: #444; }
[data-bs-theme="light"] .tag-cloud a:hover { color: #c8860a; }

[data-bs-theme="light"] .date-separator { color: #6c757d; }
[data-bs-theme="light"] .date-separator::before,
[data-bs-theme="light"] .date-separator::after { background: #dee2e6; }

[data-bs-theme="light"] .sidebar { scrollbar-color: #adb5bd #f1f3f5; }

/* ── Newspaper home ── */
.newspaper-header {
  border-bottom: 3px double #e6a817;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}
.newspaper-title {
  font-size: 0.95rem;
  color: #adb5bd;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.newspaper-date { font-size: 0.78rem; color: #6c757d; }
@media (max-width: 575px) {
  .newspaper-header { flex-direction: column !important; align-items: flex-start !important; gap: 0.2rem; }
}

/* Hero */
.hero-card {
  border-left: 4px solid #e6a817;
  background: var(--bs-body-tertiary-bg, #1a1d20);
  border-radius: 4px;
  overflow: hidden;
  height: 100%;
}
@media (max-width: 575px) {
  .hero-card { border-left: none; border-top: 4px solid #e6a817; }
}
.hero-source {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e6a817;
}
.hero-title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
  color: #ffffff;
  text-decoration: none;
}
.hero-title:hover { color: #e6a817; }
.hero-summary {
  color: #9aacb8;
  font-size: 0.88rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
[data-bs-theme="light"] .hero-title { color: #212529; }
[data-bs-theme="light"] .hero-title:hover { color: #c8860a; }
[data-bs-theme="light"] .hero-summary { color: #495057; }

/* Mappa news */
.news-map-wrapper {
  height: 100%;
  min-height: 220px;
  border-radius: 0;
  overflow: hidden;
}
#news-map {
  height: 100%;
  min-height: 220px;
  filter: saturate(0.6) brightness(0.9);
}
[data-bs-theme="light"] #news-map { filter: saturate(0.8) brightness(1); }
.leaflet-popup-content-wrapper {
  background: #1a1d20;
  color: #e0e0e0;
  border: 1px solid #2d3238;
  box-shadow: none;
}
.leaflet-popup-tip { background: #1a1d20; }
.leaflet-popup-content { font-size: 0.82rem; margin: 8px 12px; }

/* Secondarie */
.secondary-list {
  border-left: 1px solid #343a40;
  padding-left: 1rem;
  height: 100%;
}
@media (max-width: 991px) {
  .secondary-list { border-left: none; border-top: 1px solid #343a40; padding-left: 0; padding-top: 0.5rem; }
}
.secondary-item { padding: 0.6rem 0; border-bottom: 1px solid #343a40; }
.secondary-item:last-child { border-bottom: none; }
.secondary-source {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e6a817;
}
.secondary-title {
  font-size: 0.93rem;
  font-weight: 600;
  color: #e0e0e0;
  text-decoration: none;
  line-height: 1.3;
  display: block;
}
.secondary-title:hover { color: #e6a817; }
[data-bs-theme="light"] .secondary-title { color: #212529; }
[data-bs-theme="light"] .secondary-title:hover { color: #c8860a; }
[data-bs-theme="light"] .secondary-item { border-color: #dee2e6; }
[data-bs-theme="light"] .secondary-list { border-color: #dee2e6; }

/* Griglia notizie */
.news-grid-card {
  background: var(--bs-body-tertiary-bg, #1a1d20);
  border: 1px solid #2d3238;
  border-radius: 4px;
  padding: 0.8rem;
  height: 100%;
  transition: border-color 0.15s;
}
.news-grid-card:hover { border-color: #495057; }
.grid-source {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e6a817;
}
.grid-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #d0d8de;
  text-decoration: none;
  line-height: 1.35;
  display: block;
  margin: 3px 0;
}
.grid-title:hover { color: #ffffff; }
.grid-time { font-size: 0.7rem; color: #6c757d; }
[data-bs-theme="light"] .news-grid-card { border-color: #dee2e6; }
[data-bs-theme="light"] .news-grid-card:hover { border-color: #adb5bd; }
[data-bs-theme="light"] .grid-title { color: #343a40; }
[data-bs-theme="light"] .grid-title:hover { color: #212529; }

/* Divisore sezione */
.section-divider {
  display: flex; align-items: center; gap: 0.75rem;
  color: #6c757d; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin: 1.25rem 0 0.75rem;
}
.section-divider::before, .section-divider::after {
  content: ""; flex: 1; height: 1px; background: #343a40;
}
[data-bs-theme="light"] .section-divider { color: #6c757d; }
[data-bs-theme="light"] .section-divider::before,
[data-bs-theme="light"] .section-divider::after { background: #dee2e6; }

/* Meteo */
.weather-strip {
  background: var(--bs-body-tertiary-bg, #1a1d20);
  border: 1px solid #2d3238;
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
}
[data-bs-theme="light"] .weather-strip { border-color: #dee2e6; }
.weather-location { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: #6c757d; }
.weather-current-temp { font-size: 2rem; font-weight: 700; line-height: 1; color: #fff; }
[data-bs-theme="light"] .weather-current-temp { color: #212529; }
.weather-icon { font-size: 1.9rem; }
.weather-desc { font-size: 0.82rem; color: #9aacb8; }
[data-bs-theme="light"] .weather-desc { color: #495057; }
.weather-detail { font-size: 0.75rem; color: #6c757d; }
.weather-divider { width: 1px; background: #2d3238; align-self: stretch; margin: 0 0.5rem; flex-shrink: 0; }
[data-bs-theme="light"] .weather-divider { background: #dee2e6; }
.hourly-item { text-align: center; min-width: 40px; flex-shrink: 0; }
.hourly-time { font-size: 0.67rem; color: #6c757d; }
.hourly-icon { font-size: 1.1rem; }
.hourly-temp { font-size: 0.78rem; font-weight: 600; color: #e0e0e0; }
[data-bs-theme="light"] .hourly-temp { color: #212529; }
.forecast-item { text-align: center; min-width: 48px; }
.forecast-day { font-size: 0.68rem; text-transform: uppercase; color: #6c757d; font-weight: 600; }
.forecast-icon { font-size: 1.25rem; }
.forecast-hi { color: #e0e0e0; font-weight: 600; font-size: 0.78rem; }
[data-bs-theme="light"] .forecast-hi { color: #212529; }
.forecast-lo { color: #6c757d; font-size: 0.78rem; }
/* Card scopri il sito */
.discover-card {
  background: var(--bs-body-tertiary-bg, #1a1d20);
  border: 1px solid #2d3238;
  border-radius: 4px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}
.discover-card .discover-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #e6a817;
  font-weight: 600;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}
.discover-card .discover-body {
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 100px;
}
[data-bs-theme="light"] .discover-card { border-color: #dee2e6; }

/* Barre autori/testate */
.stat-bar-wrap { margin-bottom: 0.4rem; }
.stat-bar-label {
  font-size: 0.78rem;
  color: #d0d8de;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  display: inline-block;
}
[data-bs-theme="light"] .stat-bar-label { color: #343a40; }
.stat-bar-count { font-size: 0.72rem; color: #6c757d; }
.stat-bar-track {
  height: 3px;
  background: #2d3238;
  border-radius: 2px;
  margin-top: 2px;
}
[data-bs-theme="light"] .stat-bar-track { background: #dee2e6; }
.stat-bar-fill {
  height: 3px;
  background: #e6a817;
  border-radius: 2px;
}

.weather-alert {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.4);
  border-radius: 4px;
  font-size: 0.78rem;
  color: #f08080;
  padding: 0.35rem 0.75rem;
}
