/* ============================================================
   UK Attractions Intel — Main Stylesheet
   Holiday Extras brand: https://brand.holidayextras.com/
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
  /* Core palette — exact HE brand spec */
  --he-purple:    #542E91;
  --he-yellow:    #FDDC06;
  --he-black:     #232323;
  --he-offwhite:  #F0F0F0;

  /* Functional palette — HE brand UI colours */
  --func-blue:    #3AA6FF;
  --func-green:   #00B0A6;
  --func-orange:  #FFB55F;
  --func-red:     #FF5F68;
  --func-violet:  #925FFF;

  /* Park colours */
  --wbstl-blue:   #0057a8;
  --paultons-red: #e8451e;
  --peer-grey:    #aab4c2;

  /* UI */
  --bg-light:   #F0F0F0;
  --text-main:  #232323;
  --border:     #e0e0e0;
  --green:      #00B0A6;
  --red:        #FF5F68;
  --sidebar-width: 260px;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-light);
}

a { color: inherit; text-decoration: none; }

/* ── Layout ── */
body {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--he-purple);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.25rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-brand .brand-badge {
  display: inline-block;
  background: var(--he-yellow);
  color: var(--he-purple);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  width: fit-content;
}

.sidebar-brand h2 {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.55rem 1rem;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar-nav a.active {
  color: var(--he-yellow);
  font-weight: 700;
  background: rgba(253,213,6,0.1);
  border-left-color: var(--he-yellow);
}

.sidebar-nav a .nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

/* Sidebar controls */
.sidebar-controls {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-controls label,
.sidebar-controls .control-label {
  display: block;
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
  margin-top: 10px;
}

.sidebar-controls label:first-child,
.sidebar-controls .control-label:first-child {
  margin-top: 0;
}

.sidebar-controls select {
  width: 100%;
  padding: 6px 8px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23fff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.sidebar-controls select:focus {
  outline: none;
  border-color: var(--he-yellow);
}

.sidebar-controls select option {
  background: var(--he-purple);
  color: #fff;
}

.sidebar-controls input[type="range"] {
  width: 100%;
  accent-color: var(--he-yellow);
  cursor: pointer;
}

.sidebar-controls .range-value {
  color: var(--he-yellow);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  display: block;
  margin-top: 3px;
}

.sidebar-controls .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 200px;
  overflow-y: auto;
}

.sidebar-controls .checkbox-group::-webkit-scrollbar { width: 4px; }
.sidebar-controls .checkbox-group::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 2px; }

.sidebar-controls .checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  cursor: pointer;
}

.sidebar-controls .checkbox-item input[type="checkbox"] {
  accent-color: var(--he-yellow);
  cursor: pointer;
}

/* Sidebar meta / data freshness */
.sidebar-meta {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-meta .freshness-label {
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  display: block;
  margin-bottom: 2px;
}

/* ── Content area ── */
.content {
  flex: 1;
  padding: 2rem;
  min-width: 0;
  overflow-x: hidden;
}

/* ── Demo banner ── */
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #FDDC06;
  color: #542E91;
  padding: 0.6rem 1.5rem;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.demo-banner.hidden { display: none; }

/* Push body content down when demo banner is visible */
body.demo-visible .sidebar { top: 36px; }
body.demo-visible .content { padding-top: 2rem; }
body.demo-visible { padding-top: 36px; }

/* ── Page header ── */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  color: var(--he-purple);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 6px;
}

.page-header .subtitle {
  color: #666;
  font-size: 14px;
  margin-top: 4px;
}

/* ── HE Badge ── */
.he-badge {
  display: inline-block;
  background: var(--he-yellow);
  color: var(--he-purple);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 4px;
}

/* ── Metric cards ── */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.metric-card.wbstl::before  { background: var(--wbstl-blue); }
.metric-card.paultons::before { background: var(--paultons-red); }

.metric-card .card-park {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-bottom: 6px;
}

.metric-card .card-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.metric-card .card-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--he-purple);
  line-height: 1;
  margin-bottom: 8px;
  cursor: help;
}

.metric-card .card-delta {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  row-gap: 3px;
}

.delta-positive { color: var(--green); }
.delta-negative { color: var(--red); }
.delta-neutral  { color: #888; }

.metric-card .momentum-label {
  font-size: 11px;
  background: var(--bg-light);
  padding: 2px 6px;
  border-radius: 3px;
  color: #555;
  font-weight: 600;
}

.metric-card .rank-badge {
  font-size: 12px;
  color: var(--he-purple);
  font-weight: 700;
  background: rgba(84,46,145,0.08);
  padding: 2px 7px;
  border-radius: 4px;
}

/* ── Alert banners ── */
.alerts-section {
  margin-bottom: 1.5rem;
}

.alert-banner {
  border-radius: 5px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  border-left: 4px solid var(--peer-grey);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.alert-banner.severity-critical { border-left-color: var(--func-red);    background: #fff5f5; }
.alert-banner.severity-warning  { border-left-color: var(--func-orange);  background: #fffaf5; }
.alert-banner.severity-info     { border-left-color: var(--func-blue);    background: #f5faff; }
.alert-banner.severity-high     { border-left-color: var(--func-red);     background: #fff8f7; }
.alert-banner.severity-medium   { border-left-color: var(--func-orange);  background: #fffaf5; }
.alert-banner.severity-low      { border-left-color: var(--func-blue);    background: #f5faff; }

.alert-banner .alert-headline {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

.alert-banner .alert-detail {
  font-size: 12px;
  color: #555;
}

.alert-banner .alert-meta {
  font-size: 11px;
  color: #888;
  margin-top: 3px;
}

.alerts-collapsed {
  background: #f8f8f8;
  border: 1px dashed var(--border);
  border-radius: 5px;
  padding: 0.5rem 1rem;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.alerts-collapsed:hover { background: #f0f0f0; }

/* ── Data table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: var(--he-purple);
  color: #fff;
}

.data-table thead th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
  background: #f9f9fb;
}

.data-table tbody tr:hover {
  background: rgba(84,46,145,0.04);
}

.data-table tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr.focal-row > td:first-child {
  border-left: 3px solid var(--he-purple);
  padding-left: calc(0.75rem - 2px);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
}

/* ── Opportunity cards ── */
.opportunities-section {
  margin-bottom: 1.5rem;
}

.opportunity-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.opportunity-card .opp-headline {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.opportunity-card .opp-action {
  font-size: 13px;
  color: #555;
}

/* ── Chart container ── */
.chart-container {
  width: 100%;
  min-height: 350px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.chart-container .chart-title {
  padding: 0.85rem 1rem 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--he-purple);
}

.chart-container .chart-subtitle {
  padding: 0 1rem 0.25rem;
  font-size: 12px;
  color: #888;
}

.chart-inner {
  padding: 0.5rem;
}

/* ── News ── */
.news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.news-column h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--he-purple);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--he-yellow);
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-article {
  display: flex;
  gap: 10px;
  padding: 0.65rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.news-article:last-child { border-bottom: none; }

.news-article .sentiment-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.news-article .article-body { flex: 1; min-width: 0; }

.news-article .article-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 3px;
}

.news-article .article-title a {
  color: inherit;
  text-decoration: none;
}
.news-article .article-title a:hover { color: var(--he-purple); text-decoration: underline; }

.news-article .article-meta {
  font-size: 11px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.context-badge {
  background: rgba(84,46,145,0.08);
  color: var(--he-purple);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

/* ── Signal cards (VisitBritain) ── */
.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.signal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  border-top: 4px solid var(--peer-grey);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.signal-card.positive { border-top-color: var(--func-green); }
.signal-card.negative { border-top-color: var(--func-red); }
.signal-card.neutral  { border-top-color: var(--peer-grey); }

.signal-card .signal-metric {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.signal-card .signal-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--he-purple);
  margin-bottom: 4px;
}

.signal-card .signal-change {
  font-size: 12px;
  font-weight: 600;
}

.signal-card .signal-note {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Section headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--he-purple);
}

.section-subtitle {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

/* ── Card panel ── */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
}

.panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--he-purple);
  margin-bottom: 0.85rem;
}

/* ── Event cards ── */
.event-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.event-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 4px solid var(--he-purple);
}

.event-card.wbstl   { border-left-color: var(--wbstl-blue); }
.event-card.paultons { border-left-color: var(--paultons-red); }

.event-card .event-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.event-card .event-park {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 6px;
}

.event-card .event-date {
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
}

.event-card .event-uplift {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}

.event-card .event-desc {
  font-size: 12px;
  color: #666;
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Digest textarea ── */
.digest-textarea {
  width: 100%;
  min-height: 180px;
  font-family: monospace;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  resize: vertical;
  background: #fafafa;
  color: var(--text-main);
}

.digest-textarea:focus { outline: none; border-color: var(--he-purple); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1.1rem;
  border-radius: 5px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

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

.btn-primary {
  background: var(--he-purple);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-yellow {
  background: var(--he-yellow);
  color: var(--he-purple);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* ── Loading / error states ── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #888;
  gap: 10px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(84,46,145,0.2);
  border-top-color: var(--he-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  background: #fff8f7;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  color: #721c24;
}

.error-state .error-icon { font-size: 2rem; margin-bottom: 8px; }

/* ── Grid utilities ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Details/summary (collapsed news context) ── */
details { margin-bottom: 1rem; }
details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--he-purple);
  padding: 0.5rem 0.75rem;
  background: rgba(84,46,145,0.06);
  border-radius: 5px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
details > summary::before { content: '▶'; font-size: 10px; transition: transform 0.2s; }
details[open] > summary::before { transform: rotate(90deg); }
details > .details-body {
  padding: 0.75rem 0.75rem 0.25rem;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 5px 5px;
}

/* ── Movers section ── */
.mover-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.mover-up   { background: rgba(0,176,166,0.12);  color: #007a72; }
.mover-down { background: rgba(255,95,104,0.12); color: #c0001a; }

/* ── Internal data page ── */
.info-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.info-box h2 {
  color: var(--he-purple);
  font-size: 16px;
  margin-bottom: 0.75rem;
}

.info-box p, .info-box li {
  color: #444;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.info-box ul { padding-left: 1.5rem; }

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1.25rem;
  background: var(--he-purple);
  color: #fff;
  border-radius: 5px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  margin-top: 0.5rem;
  transition: opacity 0.15s;
}
.btn-link:hover { opacity: 0.85; }

/* ── Estimate label (event uplift caveat) ── */
.estimate-label {
  font-size: 10px;
  color: #888;
  border-bottom: 1px dotted #aaa;
  cursor: help;
  margin-left: 4px;
}

/* ── Booking window table ── */
.bw-table td { text-align: right; }
.bw-table td:first-child { text-align: left; }

/* ── Tooltip helper ── */
[title] { cursor: help; border-bottom: 1px dotted #aaa; }

/* ── Regional heatmap note ── */
.heatmap-note {
  font-size: 11px;
  color: #888;
  text-align: right;
  margin-top: -1rem;
  margin-bottom: 1rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  body { flex-direction: column; }

  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 0.5rem;
  }

  .sidebar-nav a {
    padding: 0.5rem 0.5rem;
    font-size: 11px;
    flex-direction: column;
    text-align: center;
    gap: 3px;
  }

  .sidebar-controls { display: none; }
  .sidebar-meta { display: none; }

  .content { padding: 1rem; }

  .news-grid { grid-template-columns: 1fr; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }

  .page-header h1 { font-size: 1.4rem; }

  .metric-cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .sidebar-nav { grid-template-columns: repeat(2, 1fr); }
}
