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

:root {
  --brand: #D85A30;
  --brand-hover: #bf4e28;
  --brand-dim: rgba(216, 90, 48, 0.15);
  --bg: #0f1117;
  --bg-card: #1a1c23;
  --bg-input: #22252e;
  --bg-hover: #1e2028;
  --border: #2a2d38;
  --border-light: #33374a;
  --text: #f0f0f0;
  --text-secondary: #8b95a8;
  --text-muted: #4a5168;
  --google-blue: #4285f4;
  --facebook-blue: #1877f2;
  --star: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --sidebar-w: 220px;
}

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 60% 0%, rgba(216,90,48,0.08) 0%, transparent 60%), var(--bg);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-logo .logo-icon {
  width: 38px; height: 38px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.auth-logo .logo-text { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.auth-logo .logo-text span { color: var(--brand); }

.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.3px; }
.auth-card .subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 14px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text); padding: 11px 14px; font-size: 15px;
  transition: border-color 0.15s; outline: none;
}
.form-group input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dim); }
.form-group input::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: background 0.15s, transform 0.1s, opacity 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); text-decoration: none; }

.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border-light); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px 14px; font-size: 13px; font-weight: 500; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }

.btn-sm { padding: 7px 13px; font-size: 13px; }

.btn-ai {
  background: rgba(216,90,48,0.12);
  color: var(--brand);
  border: 1px solid rgba(216,90,48,0.25);
}
.btn-ai:hover:not(:disabled) { background: rgba(216,90,48,0.2); text-decoration: none; }

.btn-connect-google {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-light);
  font-size: 13px; padding: 8px 16px;
}
.btn-connect-google:hover { background: var(--bg-hover); text-decoration: none; }

.btn-connect-facebook {
  background: var(--brand);
  color: white;
  font-size: 13px; padding: 8px 16px;
}
.btn-connect-facebook:hover { background: var(--brand-hover); text-decoration: none; }

.btn-google {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border-light);
  width: 100%; margin-bottom: 20px; font-weight: 500;
}
.btn-google:hover { background: var(--bg-hover); text-decoration: none; }

.divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0;
  color: var(--text-muted); font-size: 13px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.auth-footer { margin-top: 24px; text-align: center; font-size: 14px; color: var(--text-secondary); }

.error-banner {
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #f87171;
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; margin-bottom: 16px; display: none;
}
.error-banner.show { display: block; }

/* ── APP LAYOUT ── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #13151d;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 20px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.logo-text { color: var(--text); }
.logo-accent { color: var(--brand); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sidebar-item.active {
  background: var(--brand);
  color: white;
}
.sidebar-item.active svg { stroke: white; }

.sidebar-badge {
  margin-left: auto;
  background: var(--brand);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.restaurant-avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.logout-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.logout-btn:hover { background: var(--bg-hover); color: #ef4444; }

.restaurant-info { min-width: 0; }
.restaurant-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.restaurant-plan { font-size: 11px; color: var(--text-muted); }

/* ── MAIN AREA ── */
.main-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.greeting {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.greeting-sub { font-size: 14px; color: var(--text-secondary); margin-top: 3px; }
.highlight-text { color: var(--brand); font-weight: 600; }

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

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

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

.stat-amber::before { background: #f59e0b; }
.stat-orange::before { background: var(--brand); }
.stat-blue::before { background: #3b82f6; }
.stat-green::before { background: #22c55e; }

.stat-label {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 8px;
}

.stat-value {
  font-size: 30px; font-weight: 800; letter-spacing: -1px;
  line-height: 1; margin-bottom: 6px; color: var(--text);
}

.stat-sub { font-size: 12px; color: var(--text-secondary); }
.stat-trend { font-size: 12px; margin-top: 4px; }
.trend-up { color: #4ade80; }
.trend-down { color: #f87171; }

/* ── CONTENT ROW ── */
.content-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* ── REVIEWS SECTION ── */
.reviews-section { flex: 1; min-width: 0; }

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.pending-pill {
  background: var(--brand);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── TAB FILTERS ── */
.tab-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.tab-btn:hover { background: var(--bg-hover); color: var(--text); }

.tab-btn.active {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text);
  font-weight: 600;
}

/* ── REVIEWS LIST ── */
.reviews-list { display: flex; flex-direction: column; gap: 12px; }

.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s;
}
.review-card:hover { border-color: var(--border-light); }
.review-card.responded { border-left: 3px solid var(--green); }
.review-card.low-rating { border-left: 3px solid var(--red); }

.review-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.reviewer-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--brand);
  flex-shrink: 0;
  border: 2px solid var(--border-light);
}

.reviewer-info { flex: 1; min-width: 0; }

.reviewer-top {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 3px;
}

.reviewer-name { font-weight: 600; font-size: 14px; }

.review-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 6px; flex-shrink: 0;
}

.review-time { font-size: 11px; color: var(--text-muted); }

.badge-pending {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(216,90,48,0.15);
  color: var(--brand);
  border: 1px solid rgba(216,90,48,0.3);
}

.badge-responded {
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(34,197,94,0.1);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.2);
}

.platform-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: 0.4px;
}
.badge-google { background: rgba(66,133,244,0.12); color: #60a5fa; border: 1px solid rgba(66,133,244,0.2); }
.badge-facebook { background: rgba(129,140,248,0.12); color: #818cf8; border: 1px solid rgba(129,140,248,0.2); }

.stars { display: inline-flex; gap: 1px; font-size: 13px; }
.star-filled { color: var(--star); }
.star-empty { color: var(--text-muted); }

.review-date { font-size: 11px; color: var(--text-muted); }

.review-content {
  color: var(--text-secondary); font-size: 14px; line-height: 1.7; margin-bottom: 14px;
}

.review-actions { display: flex; align-items: center; gap: 8px; }

/* ── RESPONSE AREA ── */
.response-area {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: none;
}
.response-area.open { display: block; }

.existing-response {
  background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.15);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px;
}
.existing-response-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px;
  color: #4ade80; margin-bottom: 6px;
}
.existing-response-text { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.response-textarea {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text); padding: 12px 14px;
  font-size: 14px; font-family: inherit; line-height: 1.6; resize: vertical;
  min-height: 100px; outline: none; transition: border-color 0.15s; margin-bottom: 10px;
}
.response-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dim); }
.response-textarea::placeholder { color: var(--text-muted); }

.response-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.response-footer-right { display: flex; align-items: center; gap: 8px; }

.ai-loading { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }

/* ── RIGHT COLUMN ── */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 300px;
  min-width: 300px;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* ── AI PANEL ── */
.ai-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.ai-panel-body { padding: 16px 18px; flex: 1; }

.ai-panel-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.ai-review-preview {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.ai-reviewer-name {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

.ai-review-quote {
  font-size: 13px; color: var(--text-secondary);
  font-style: italic; line-height: 1.5;
}

.ai-suggestion-text {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.7;
}

/* ── ALERTS PANEL ── */
.alerts-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.alerts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.alerts-list { padding: 8px 0; }

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  transition: background 0.15s;
}
.alert-item:hover { background: var(--bg-hover); }

.alert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.alert-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.alert-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── SPINNER ── */
.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--border-light);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 50px 24px; color: var(--text-secondary); }
.empty-state .icon { font-size: 40px; margin-bottom: 14px; opacity: 0.4; }
.empty-state h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ── SKELETON ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, #222 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-card { height: 140px; border-radius: var(--radius); margin-bottom: 12px; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 12px 18px; font-size: 14px;
  box-shadow: var(--shadow); animation: slideIn 0.2s ease; max-width: 300px;
}
.toast.success { border-left: 3px solid var(--green); color: #4ade80; }
.toast.error { border-left: 3px solid var(--red); color: #f87171; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .right-column { display: none; }
  .content-row { flex-direction: column; }
}

@media (max-width: 640px) {
  .sidebar { display: none; }
  .app-layout { flex-direction: column; }
  .main-area { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .connect-btns { width: 100%; }
  .tab-filters { gap: 2px; }
  .tab-btn { padding: 5px 10px; font-size: 12px; }
}
