/* portal.css — Executive customer portal. Clean white/minimal. Mobile-first. */

:root {
  --p-white: #ffffff;
  --p-bg: #f5f5f7;
  --p-card: #ffffff;
  --p-border: #e5e5ea;
  --p-text: #1d1d1f;
  --p-muted: #6e6e73;
  --p-subtle: #aeaeb2;
  --p-green: #30d158;
  --p-yellow: #ff9f0a;
  --p-orange: #ff6b00;
  --p-red: #ff3b30;
  --p-blue: #0071e3;
  --p-indigo: #5e5ce6;
  --p-green-bg: rgba(48, 209, 88, 0.10);
  --p-yellow-bg: rgba(255, 159, 10, 0.10);
  --p-red-bg: rgba(255, 59, 48, 0.10);
  --p-blue-bg: rgba(0, 113, 227, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 20px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.10);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--p-bg);
  color: var(--p-text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────── */

.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.portal-sidebar {
  width: 240px;
  background: var(--p-white);
  border-right: 1px solid var(--p-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--p-border);
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--p-text);
  letter-spacing: -0.02em;
}

.sidebar-logo span {
  color: var(--p-blue);
}

.sidebar-tagline {
  font-size: 0.7rem;
  color: var(--p-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--p-muted);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--p-blue-bg);
  color: var(--p-blue);
}

.sidebar-nav a .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-hotel-selector {
  padding: 16px 20px;
  border-top: 1px solid var(--p-border);
}

.hotel-selector-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--p-muted);
  margin-bottom: 6px;
}

.hotel-selector-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--p-border);
  border-radius: var(--radius-sm);
  background: var(--p-bg);
  color: var(--p-text);
  font-size: 0.82rem;
  font-family: var(--font);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aeaeb2' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ── Main content ────────────────────────────────────────────── */

.portal-main {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
}

.portal-topbar {
  background: var(--p-white);
  border-bottom: 1px solid var(--p-border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-hotel-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--p-text);
}

.topbar-freshness {
  font-size: 0.78rem;
  color: var(--p-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--p-blue);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-export:hover { opacity: 0.88; }

/* ── Content area ────────────────────────────────────────────── */

.portal-content {
  padding: 32px;
  max-width: 1100px;
}

/* ── Section headers ─────────────────────────────────────────── */

.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--p-text);
}

.section-sub {
  font-size: 0.85rem;
  color: var(--p-muted);
  margin-top: 2px;
}

/* ── Section spacing ─────────────────────────────────────────── */

.portal-section {
  margin-bottom: 48px;
  scroll-margin-top: 80px;
}

/* ── Hero score ──────────────────────────────────────────────── */

.score-hero {
  background: var(--p-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 24px;
}

.score-big {
  text-align: center;
  min-width: 110px;
}

.score-number {
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.score-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--p-muted);
  margin-top: 4px;
}

.grade-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  border: 3px solid;
  flex-shrink: 0;
}

.grade-A { color: var(--p-green); border-color: var(--p-green); background: var(--p-green-bg); }
.grade-B { color: #0071e3; border-color: #0071e3; background: var(--p-blue-bg); }
.grade-C { color: var(--p-yellow); border-color: var(--p-yellow); background: var(--p-yellow-bg); }
.grade-D { color: var(--p-orange); border-color: var(--p-orange); background: rgba(255,107,0,0.10); }
.grade-F { color: var(--p-red); border-color: var(--p-red); background: var(--p-red-bg); }

.score-meta {
  flex: 1;
}

.score-headline {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.score-hotel {
  font-size: 0.9rem;
  color: var(--p-muted);
}

/* ── Headline cards ──────────────────────────────────────────── */

.headline-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 0;
}

.headline-card {
  background: var(--p-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.headline-card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--p-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.headline-card-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--p-text);
  line-height: 1.3;
}

.headline-card-value.warn { color: var(--p-orange); }
.headline-card-value.crit { color: var(--p-red); }
.headline-card-value.good { color: var(--p-green); }
.headline-card-empty { color: var(--p-subtle); font-weight: 400; font-size: 0.9rem; }

/* ── Recommendation cards ────────────────────────────────────── */

.rec-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-card {
  background: var(--p-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow 0.18s;
}

.rec-card:hover { box-shadow: var(--shadow-hover); }

.rec-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.rec-icon.cat-reviews  { background: var(--p-blue-bg); }
.rec-icon.cat-web      { background: rgba(48,209,88,0.10); }
.rec-icon.cat-social   { background: rgba(94,92,230,0.10); }
.rec-icon.cat-staffing { background: var(--p-yellow-bg); }
.rec-icon.cat-seo      { background: rgba(0,113,227,0.10); }
.rec-icon.cat-pricing  { background: rgba(255,107,0,0.10); }
.rec-icon.cat-default  { background: var(--p-blue-bg); }

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

.rec-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--p-text);
  margin-bottom: 4px;
}

.rec-action {
  font-size: 0.83rem;
  color: var(--p-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.rec-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rec-badge.impact-high   { background: var(--p-red-bg); color: var(--p-red); }
.rec-badge.impact-medium { background: var(--p-yellow-bg); color: var(--p-orange); }
.rec-badge.impact-low    { background: var(--p-green-bg); color: var(--p-green); }
.rec-badge.urg-critical  { background: var(--p-red-bg); color: var(--p-red); }
.rec-badge.urg-high      { background: rgba(255,107,0,0.10); color: var(--p-orange); }
.rec-badge.urg-medium    { background: var(--p-yellow-bg); color: var(--p-yellow); }

.rec-dismiss-btn {
  background: none;
  border: 1px solid var(--p-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--p-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.rec-dismiss-btn:hover {
  background: var(--p-red-bg);
  color: var(--p-red);
  border-color: var(--p-red);
}

/* ── Competitive chart ───────────────────────────────────────── */

.comp-grid {
  background: var(--p-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.comp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.comp-row:last-child { margin-bottom: 0; }

.comp-label {
  font-size: 0.82rem;
  color: var(--p-text);
  font-weight: 500;
  width: 160px;
  flex-shrink: 0;
}

.comp-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comp-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comp-bar-track {
  flex: 1;
  height: 8px;
  background: var(--p-border);
  border-radius: 100px;
  overflow: hidden;
}

.comp-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1);
}

.comp-bar-fill.hotel { background: var(--p-blue); }
.comp-bar-fill.fleet { background: var(--p-border); background: #d1d1d6; }

.comp-bar-label {
  font-size: 0.7rem;
  color: var(--p-muted);
  width: 50px;
  text-align: right;
}

.comp-bar-val {
  font-size: 0.78rem;
  font-weight: 600;
  width: 38px;
  text-align: right;
}

.comp-bar-val.above { color: var(--p-green); }
.comp-bar-val.below { color: var(--p-red); }
.comp-bar-val.even  { color: var(--p-muted); }

.comp-legend {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--p-border);
}

.comp-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--p-muted);
}

.comp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── Score trend chart ───────────────────────────────────────── */

.trend-card {
  background: var(--p-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.trend-chart-area {
  height: 200px;
  position: relative;
}

canvas#trendChart {
  width: 100% !important;
  height: 200px !important;
}

.trend-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--p-border);
}

.trend-stat {
  text-align: center;
}

.trend-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--p-text);
}

.trend-stat-lbl {
  font-size: 0.72rem;
  color: var(--p-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Alert feed ──────────────────────────────────────────────── */

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-card {
  background: var(--p-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-left: 3px solid transparent;
  transition: box-shadow 0.18s;
}

.alert-card.sev-critical { border-left-color: var(--p-red); }
.alert-card.sev-warning  { border-left-color: var(--p-yellow); }
.alert-card.sev-info     { border-left-color: var(--p-blue); }

.alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

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

.alert-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--p-text);
  margin-bottom: 2px;
}

.alert-msg {
  font-size: 0.82rem;
  color: var(--p-muted);
}

.alert-time {
  font-size: 0.72rem;
  color: var(--p-subtle);
  margin-top: 4px;
}

.alert-resolve-btn {
  background: none;
  border: 1px solid var(--p-border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.75rem;
  color: var(--p-muted);
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.alert-resolve-btn:hover {
  background: var(--p-green-bg);
  color: var(--p-green);
  border-color: var(--p-green);
}

/* ── Empty states ────────────────────────────────────────────── */

.empty-state {
  background: var(--p-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  text-align: center;
  color: var(--p-muted);
  font-size: 0.9rem;
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
  opacity: 0.5;
}

/* ── Score color helpers ─────────────────────────────────────── */

.score-green  { color: var(--p-green); }
.score-blue   { color: #0071e3; }
.score-yellow { color: var(--p-yellow); }
.score-orange { color: var(--p-orange); }
.score-red    { color: var(--p-red); }

/* ── No hotel selected ───────────────────────────────────────── */

.portal-empty-hero {
  text-align: center;
  padding: 80px 32px;
}

.portal-empty-hero h2 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--p-text);
}

.portal-empty-hero p {
  color: var(--p-muted);
  font-size: 1rem;
}

/* ── Mobile ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .portal-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--p-border);
  }

  .portal-layout { flex-direction: column; }
  .portal-main { margin-left: 0; }
  .portal-content { padding: 16px; }

  .portal-sidebar { display: none; }

  .portal-topbar {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .headline-cards { grid-template-columns: 1fr; }
  .score-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .comp-label { width: 110px; font-size: 0.75rem; }
  .trend-stats { flex-wrap: wrap; gap: 16px; }
}

@media (min-width: 769px) {
  .mobile-hotel-bar { display: none; }
}

.mobile-hotel-bar {
  background: var(--p-white);
  border-bottom: 1px solid var(--p-border);
  padding: 12px 16px;
}

/* ── Animations ──────────────────────────────────────────────── */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.portal-section {
  animation: fadeInUp 0.3s ease both;
}

.portal-section:nth-child(2) { animation-delay: 0.05s; }
.portal-section:nth-child(3) { animation-delay: 0.10s; }
.portal-section:nth-child(4) { animation-delay: 0.15s; }
.portal-section:nth-child(5) { animation-delay: 0.20s; }
