/* ============================================================
   StayLocal — Clear Horizon Design System
   Same palette + typography as the Flutter app
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

/* ---------- Tokens ---------- */
:root {
  /* Colors */
  --sl-primary: #0077B6;
  --sl-primary-light: #00B4D8;
  --sl-primary-dark: #005A8C;
  --sl-accent: #FFB703;
  --sl-accent-hover: #E5A503;
  --sl-bg: #FFFFFF;
  --sl-surface: #F8F9FA;
  --sl-border: #E9ECEF;
  --sl-text: #1B1B1E;
  --sl-text-secondary: #6C757D;
  --sl-success: #2DC653;
  --sl-error: #E63946;
  --sl-warning: #FFB703;

  /* Role colors */
  --sl-vendor: #E67E22;
  --sl-host: #27AE60;
  --sl-admin: #8E44AD;

  /* Typography */
  --sl-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --sl-radius: 12px;
  --sl-radius-sm: 8px;
  --sl-radius-lg: 20px;
  --sl-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --sl-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--sl-font);
  color: var(--sl-text);
  background: var(--sl-bg);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--sl-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--sl-primary-dark); }

img { max-width: 100%; display: block; }

/* ---------- Typography ---------- */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.625rem; font-weight: 700; line-height: 1.25; }
h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
h4 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }

.text-secondary { color: var(--sl-text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 520px; }
.container--mid { max-width: 800px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.gap-xl { gap: 40px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1 { font-size: 1.625rem; }
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sl-border);
  padding: 0 24px;
}

.navbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar__logo {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--sl-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar__logo span { color: var(--sl-primary); }

.navbar__links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.navbar__links a {
  color: var(--sl-text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.2s;
}

.navbar__links a:hover,
.navbar__links a.active { color: var(--sl-primary); }

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile nav toggle */
.navbar__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.navbar__toggle svg { width: 24px; height: 24px; color: var(--sl-text); }

@media (max-width: 768px) {
  .navbar__links { display: none; }
  .navbar__toggle { display: block; }
  .navbar__actions .btn--outline { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--sl-radius);
  font-family: var(--sl-font);
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
}

.btn--primary {
  background: var(--sl-accent);
  color: var(--sl-text);
}

.btn--primary:hover {
  background: var(--sl-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 183, 3, 0.3);
  color: var(--sl-text);
}

.btn--secondary {
  background: var(--sl-primary);
  color: #fff;
}

.btn--secondary:hover {
  background: var(--sl-primary-dark);
  transform: translateY(-1px);
  color: #fff;
}

.btn--outline {
  background: transparent;
  color: var(--sl-primary);
  border: 1.5px solid var(--sl-border);
}

.btn--outline:hover {
  border-color: var(--sl-primary);
  background: rgba(0, 119, 182, 0.04);
  color: var(--sl-primary);
}

.btn--ghost {
  background: transparent;
  color: var(--sl-text-secondary);
  padding: 8px 16px;
}

.btn--ghost:hover { color: var(--sl-text); background: var(--sl-surface); }

.btn--sm { padding: 8px 16px; font-size: 0.8125rem; }
.btn--lg { padding: 16px 32px; font-size: 1.0625rem; }
.btn--full { width: 100%; }
.btn--icon { padding: 10px; }

.btn:disabled, .btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border-radius: var(--sl-radius);
  box-shadow: var(--sl-shadow);
  padding: 24px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card--hover:hover {
  box-shadow: var(--sl-shadow-lg);
  transform: translateY(-2px);
}

.card--bordered {
  box-shadow: none;
  border: 1px solid var(--sl-border);
}

.card--surface { background: var(--sl-surface); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
  color: var(--sl-text);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--sl-border);
  border-radius: var(--sl-radius);
  font-family: var(--sl-font);
  font-size: 0.9375rem;
  color: var(--sl-text);
  background: var(--sl-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--sl-primary);
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
  background: #fff;
}

.form-input::placeholder { color: var(--sl-text-secondary); opacity: 0.6; }

.form-input--error { border-color: var(--sl-error); }

.form-hint {
  font-size: 0.8125rem;
  color: var(--sl-text-secondary);
  margin-top: 4px;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--sl-error);
  margin-top: 4px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236C757D' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

/* ---------- Flash Messages ---------- */
.flash {
  padding: 14px 20px;
  border-radius: var(--sl-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.flash--success { background: rgba(45, 198, 83, 0.1); color: #1a7a35; border: 1px solid rgba(45, 198, 83, 0.2); }
.flash--error { background: rgba(230, 57, 70, 0.1); color: #b52d36; border: 1px solid rgba(230, 57, 70, 0.2); }
.flash--warning { background: rgba(255, 183, 3, 0.1); color: #8a6300; border: 1px solid rgba(255, 183, 3, 0.2); }
.flash--info { background: rgba(0, 119, 182, 0.08); color: var(--sl-primary-dark); border: 1px solid rgba(0, 119, 182, 0.15); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--success { background: rgba(45, 198, 83, 0.12); color: #1a7a35; }
.badge--error { background: rgba(230, 57, 70, 0.12); color: #b52d36; }
.badge--warning { background: rgba(255, 183, 3, 0.12); color: #8a6300; }
.badge--info { background: rgba(0, 119, 182, 0.1); color: var(--sl-primary); }
.badge--pending { background: rgba(108, 117, 125, 0.1); color: var(--sl-text-secondary); }

/* ---------- Tables ---------- */
.table-wrapper { overflow-x: auto; border-radius: var(--sl-radius); border: 1px solid var(--sl-border); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  background: var(--sl-surface);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  color: var(--sl-text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--sl-border);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--sl-border);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(0, 119, 182, 0.02); }

/* ---------- Auth Layout ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sl-surface);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--sl-radius-lg);
  box-shadow: var(--sl-shadow-lg);
  padding: 40px;
}

.auth-card--wide {
  max-width: 640px;
}

.auth-card__logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card__logo h1 {
  font-size: 1.625rem;
  font-weight: 800;
}

.auth-card__logo h1 span { color: var(--sl-primary); }

.auth-card__logo p {
  color: var(--sl-text-secondary);
  font-size: 0.9375rem;
  margin-top: 4px;
}

.auth-card__divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--sl-text-secondary);
  font-size: 0.8125rem;
}

.auth-card__divider::before,
.auth-card__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sl-border);
}

.auth-card__footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--sl-text-secondary);
}

.auth-card__footer a { font-weight: 600; }

/* Social login buttons */
.btn--google {
  background: #fff;
  border: 1.5px solid var(--sl-border);
  color: var(--sl-text);
  width: 100%;
}

.btn--google:hover { background: var(--sl-surface); color: var(--sl-text); }

.btn--apple {
  background: #000;
  color: #fff;
  width: 100%;
}

.btn--apple:hover { background: #1a1a1a; color: #fff; }

/* ---------- Sidebar Layout (Portals) ---------- */
.portal {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--sl-text);
  color: #fff;
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar__logo {
  padding: 0 24px 24px;
  font-size: 1.25rem;
  font-weight: 800;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}

.sidebar__logo span { color: var(--sl-accent); }

.sidebar__role {
  padding: 0 24px;
  margin-bottom: 24px;
}

.sidebar__role-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar__role-badge--host { background: rgba(39, 174, 96, 0.2); color: #5dd68d; }
.sidebar__role-badge--vendor { background: rgba(230, 126, 34, 0.2); color: #f0a54c; }
.sidebar__role-badge--admin { background: rgba(142, 68, 173, 0.2); color: #bb84d4; }

.sidebar__nav { list-style: none; }

.sidebar__nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s;
}

.sidebar__nav-item a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar__nav-item a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-right: 3px solid var(--sl-accent);
}

.sidebar__nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar__section {
  padding: 16px 24px 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
}

.sidebar__footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 24px;
}

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

.sidebar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sl-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar__user-info { overflow: hidden; }
.sidebar__user-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-email { font-size: 0.75rem; color: rgba(255, 255, 255, 0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.portal__main {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  background: var(--sl-surface);
  min-height: 100vh;
}

.portal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.portal__header h1 { font-size: 1.5rem; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .portal__main { margin-left: 0; }
}

/* ---------- Landing Page ---------- */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 180, 216, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 183, 3, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: 3rem;
  max-width: 700px;
  margin: 0 auto 20px;
  letter-spacing: -0.03em;
}

.hero h1 span { color: var(--sl-primary); }

.hero p {
  font-size: 1.1875rem;
  color: var(--sl-text-secondary);
  max-width: 540px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .hero { padding: 60px 0 40px; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
}

.section {
  padding: 80px 0;
}

.section--surface { background: var(--sl-surface); }

.section__header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 48px;
}

.section__header p {
  color: var(--sl-text-secondary);
  margin-top: 12px;
  font-size: 1.0625rem;
}

.feature-card {
  padding: 32px;
  border-radius: var(--sl-radius-lg);
  background: #fff;
  border: 1px solid var(--sl-border);
  transition: all 0.3s ease;
}

.feature-card:hover {
  border-color: var(--sl-primary);
  box-shadow: 0 8px 30px rgba(0, 119, 182, 0.08);
  transform: translateY(-4px);
}

.feature-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.feature-card__icon--blue { background: rgba(0, 119, 182, 0.1); color: var(--sl-primary); }
.feature-card__icon--gold { background: rgba(255, 183, 3, 0.12); color: #C08B00; }
.feature-card__icon--green { background: rgba(45, 198, 83, 0.1); color: #1a7a35; }
.feature-card__icon--orange { background: rgba(230, 126, 34, 0.1); color: #c06a12; }

.feature-card h3 { margin-bottom: 8px; }
.feature-card p { color: var(--sl-text-secondary); font-size: 0.9375rem; line-height: 1.6; }

/* Role cards on landing page */
.role-card {
  text-align: center;
  padding: 40px 32px;
  border-radius: var(--sl-radius-lg);
  border: 1px solid var(--sl-border);
  background: #fff;
  transition: all 0.3s ease;
}

.role-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sl-shadow-lg);
}

.role-card__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.75rem;
}

.role-card h3 { margin-bottom: 8px; }
.role-card p { color: var(--sl-text-secondary); font-size: 0.875rem; margin-bottom: 20px; line-height: 1.6; }

/* ---------- Footer ---------- */
.footer {
  background: var(--sl-text);
  color: rgba(255, 255, 255, 0.6);
  padding: 48px 0 32px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer__brand h3 { color: #fff; margin-bottom: 12px; }
.footer__brand h3 span { color: var(--sl-accent); }
.footer__brand p { font-size: 0.875rem; line-height: 1.6; max-width: 280px; }

.footer h4 { color: #fff; font-size: 0.875rem; margin-bottom: 16px; }

.footer__links { list-style: none; }
.footer__links li { margin-bottom: 8px; }
.footer__links a { color: rgba(255, 255, 255, 0.5); font-size: 0.875rem; transition: color 0.2s; }
.footer__links a:hover { color: #fff; }

.footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  font-size: 0.8125rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 768px) {
  .footer__grid { grid-template-columns: 1fr; gap: 32px; }
  .footer__bottom { flex-direction: column; gap: 12px; }
}

/* ---------- Stat Cards ---------- */
.stat-card {
  padding: 24px;
  border-radius: var(--sl-radius);
  background: #fff;
  border: 1px solid var(--sl-border);
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--sl-text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card__label {
  font-size: 0.8125rem;
  color: var(--sl-text-secondary);
  font-weight: 500;
}

/* ---------- Empty States ---------- */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--sl-text-secondary);
}

.empty__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty h3 { color: var(--sl-text); margin-bottom: 8px; }
.empty p { max-width: 360px; margin: 0 auto; }

/* ---------- Utilities ---------- */
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 40px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mb-xl { margin-bottom: 40px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none; }
