/* ═══════════════════════════════════════════════════════════
   FalsterboStay Revenue Manager — 2026 Design System
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Surface palette */
  --bg: #0a0a0f;
  --bg-subtle: #111118;
  --surface: #16161e;
  --surface-raised: #1c1c27;
  --surface-overlay: #22222e;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --border-interactive: rgba(255, 255, 255, 0.15);

  /* Text */
  --text: #ececf1;
  --text-secondary: #8e8ea0;
  --text-tertiary: #565669;
  --text-inverse: #0a0a0f;

  /* Accent — warm sand/amber for a Swedish coastal vibe */
  --accent: #e8a44a;
  --accent-hover: #f0b45e;
  --accent-subtle: rgba(232, 164, 74, 0.12);
  --accent-border: rgba(232, 164, 74, 0.25);

  /* Semantic */
  --success: #34d399;
  --success-subtle: rgba(52, 211, 153, 0.1);
  --success-border: rgba(52, 211, 153, 0.2);
  --warning: #fbbf24;
  --warning-subtle: rgba(251, 191, 36, 0.1);
  --warning-border: rgba(251, 191, 36, 0.2);
  --danger: #f87171;
  --danger-subtle: rgba(248, 113, 113, 0.1);
  --danger-border: rgba(248, 113, 113, 0.2);
  --info: #60a5fa;
  --info-subtle: rgba(96, 165, 250, 0.1);

  /* Layout */
  --sidebar-w: 240px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(232, 164, 74, 0.15);

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 0.2s;
}

/* ─── Reset ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
}

/* ─── App Shell ─────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform var(--duration) var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #d4893a);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-inverse);
  flex-shrink: 0;
}

.brand-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-sub {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* Nav items */
.sidebar-nav {
  flex: 1;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
  position: relative;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--duration) var(--ease);
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface);
}
.nav-item:hover svg { opacity: 0.9; }

.nav-item.active {
  color: var(--accent);
  background: var(--accent-subtle);
}
.nav-item.active svg { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.pulse-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--accent), #d4893a);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-sm), var(--shadow-glow);
}
.pulse-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow), 0 0 30px rgba(232, 164, 74, 0.2);
}
.pulse-btn:active { transform: translateY(0); }
.pulse-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 8px 4px;
  font-size: 11px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.status-label { font-weight: 500; }

.status-detail {
  width: 100%;
  padding-left: 12px;
  font-size: 10px;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background var(--duration);
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 6px var(--danger); animation: pulse-dot 2s ease infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── API Offline Banner ────────────────────────── */
.api-banner {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--danger-subtle);
  border-bottom: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  transform: translateY(-100%);
  transition: transform 0.3s var(--ease);
}
.api-banner.show { transform: translateY(0); }

/* ─── Main Content ──────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
  min-height: 100vh;
  animation: fadeIn 0.3s var(--ease);
}

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

/* ─── Page Header ───────────────────────────────── */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-header p {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ─── Metric Cards ──────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}
.metric-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.metric-sub .up { color: var(--success); font-weight: 500; }
.metric-sub .down { color: var(--danger); font-weight: 500; }

/* ─── Section Title ─────────────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ─── Property Cards ────────────────────────────── */
.property-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.prop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: all var(--duration) var(--ease);
}
.prop-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.prop-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 4px;
}

.prop-card h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.prop-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

.prop-notes {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--surface-raised);
  border-radius: var(--radius);
  border-left: 2px solid var(--accent-border);
}

.prop-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.prop-stat {
  font-size: 12px;
  color: var(--text-tertiary);
}

.prop-stat strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ─── Recommendation Cards ──────────────────────── */
.rec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: all var(--duration) var(--ease);
}
.rec-card:hover {
  border-color: var(--border-strong);
}

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.rec-title {
  font-size: 14px;
  font-weight: 600;
}

.rec-property {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.rec-reasoning {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  padding: 14px 16px;
  background: var(--surface-raised);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.rec-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.rec-actions {
  display: flex;
  gap: 8px;
}

/* ─── Badges ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-high { background: var(--success-subtle); color: var(--success); border: 1px solid var(--success-border); }
.badge-medium { background: var(--warning-subtle); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-low { background: var(--danger-subtle); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-pending { background: var(--warning-subtle); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-approved { background: var(--success-subtle); color: var(--success); border: 1px solid var(--success-border); }
.badge-rejected { background: var(--danger-subtle); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-auto_applied { background: var(--info-subtle); color: var(--info); border: 1px solid rgba(96, 165, 250, 0.2); }

/* ─── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border-interactive);
  background: var(--surface-raised);
  color: var(--text);
  transition: all var(--duration) var(--ease);
}
.btn:hover {
  background: var(--surface-overlay);
  border-color: var(--border-strong);
}

.btn-approve {
  background: var(--success-subtle);
  color: var(--success);
  border-color: var(--success-border);
}
.btn-approve:hover {
  background: rgba(52, 211, 153, 0.2);
}

.btn-reject {
  background: var(--danger-subtle);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-reject:hover {
  background: rgba(248, 113, 113, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #d4893a);
  color: var(--text-inverse);
  border: none;
  font-weight: 600;
}
.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* ─── Filter Tabs ───────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 3px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
  text-transform: capitalize;
}
.filter-tab:hover { color: var(--text); background: var(--surface-raised); }
.filter-tab.active {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* ─── Tables ────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-secondary);
}

tr:last-child td { border-bottom: none; }
tr { transition: background var(--duration); }
tr:hover td { background: var(--surface-raised); }

td.mono {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ─── Forms ─────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.form-section h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 160px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--duration);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23565669' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-group textarea { resize: vertical; min-height: 60px; }

/* ─── Empty States ──────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-tertiary);
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 22px;
}

.empty-state h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── Toast ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--surface-overlay);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: all 0.3s var(--ease);
  z-index: 200;
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.toast-container.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ─── Loading States ────────────────────────────── */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  gap: 16px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.loader {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface) 25%,
    var(--surface-raised) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius);
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Property detail table ─────────────────────── */
.detail-table {
  width: 100%;
  margin-top: 14px;
}

.detail-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.detail-table td:first-child {
  color: var(--text-tertiary);
  font-size: 12px;
  width: 140px;
  padding-right: 16px;
}

.detail-table tr:last-child td { border-bottom: none; }

/* ─── Event row states ──────────────────────────── */
.row-past { opacity: 0.4; }

/* ─── Page transition ───────────────────────────── */
.page-enter {
  animation: pageEnter 0.3s var(--ease);
}

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

/* ─── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-brand { padding: 16px 12px; }
  .brand-text { display: none; }
  .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .pulse-btn span { display: none; }
  .pulse-btn { padding: 10px; justify-content: center; }
  .main-content { margin-left: 64px; padding: 20px 16px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
