/* Roof Roof Solutions — Shared Site Shell (Light Mode) */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  --bg: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --bg-surface: #f7f7f8;
  --bg-hero: #fafafa;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #ea580c;
  --accent-light: #fff7ed;
  --accent-lighter: #fed7aa;
  --accent-glow: rgba(234,88,12,0.10);
  --accent-hover: #c2410c;
  --border: #e5e7eb;
  --border-light: #f1f5f9;
  --border-dark: #cbd5e1;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-lg: 16px;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --red: #ef4444;
  --red-light: #fef2f2;
  --yellow: #f59e0b;
  --yellow-light: #fffbeb;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ─── NAV ─── */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}

.site-nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.logo {
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav-right { display: flex; align-items: center; gap: 24px; }

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  letter-spacing: -0.01em;
}

.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--accent); }

.nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  font-family: inherit;
}

.nav-btn:hover { border-color: var(--border-dark); background: var(--bg-surface); }

.nav-btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.nav-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.nav-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

/* ─── FOOTER ─── */
.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer p { font-size: 13px; color: var(--text-muted); }

.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 13px; color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--text); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 8px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; border: none; transition: all 0.2s;
  letter-spacing: -0.01em;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(234,88,12,0.25); }
.btn-secondary { background: var(--bg-surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); border-color: var(--border-dark); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red-light); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── DASHBOARD LAYOUT ─── */
.dash-layout {
  display: flex;
  min-height: calc(100vh - 72px - 97px);
  background: var(--bg-surface);
}

.dash-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  background: white;
}

.dash-sidebar-nav { list-style: none; }
.dash-sidebar-nav li { margin-bottom: 2px; }

.dash-sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  border: none; background: none; width: 100%; font-family: inherit;
}

.dash-sidebar-link:hover { background: var(--bg-surface); color: var(--text); }
.dash-sidebar-link.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

.dash-main {
  flex: 1;
  padding: 28px 32px;
  background: var(--bg-surface);
  min-width: 0;
}

/* ─── DASHBOARD COMPONENTS ─── */
.page-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 20px; letter-spacing: -0.02em; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: white; border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-value.green { color: var(--accent); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--border); margin-bottom: 20px; overflow: hidden;
}
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 0; }
.card-body.padded { padding: 24px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; padding: 10px 16px; background: var(--bg-surface); font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-surface); }
tbody tr.clickable { cursor: pointer; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: 0.03em; text-transform: uppercase; }
.badge-green { background: var(--accent-light); color: var(--accent); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--bg-surface); color: var(--text-muted); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-red { background: var(--red-light); color: var(--red); }

/* Forms */
.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, .form-group select, .form-group textarea {
  width: 100%; background: white; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; color: var(--text); font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Panel / slide-in */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 200; display: none; opacity: 0; transition: opacity 0.2s; }
.panel-overlay.open { display: block; opacity: 1; }
.detail-panel { position: fixed; top: 0; right: -520px; bottom: 0; width: 500px; max-width: 100vw; background: white; z-index: 210; box-shadow: -4px 0 30px rgba(0,0,0,0.1); transition: right 0.3s ease; overflow-y: auto; }
.detail-panel.open { right: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: white; z-index: 1; }
.panel-header h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.panel-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; }
.panel-close:hover { background: var(--bg-surface); color: var(--text); }
.panel-body { padding: 24px; }
.panel-field { margin-bottom: 16px; }
.panel-field .pf-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.panel-field .pf-value { font-size: 14px; color: var(--text); }
.panel-field a { color: var(--accent); text-decoration: none; }
.panel-field a:hover { text-decoration: underline; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.filters select, .filters input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; color: var(--text-secondary); background: white; }
.filters select:focus, .filters input:focus { outline: none; border-color: var(--accent); }

/* Auth screen */
.auth-screen { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 72px); padding: 24px; background: var(--bg-surface); }
.auth-card { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 420px; border: 1px solid var(--border); }
.auth-card .auth-logo { font-size: 20px; font-weight: 800; text-align: center; margin-bottom: 8px; color: var(--text); }
.auth-card .auth-logo span { color: var(--accent); }
.auth-card .auth-subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.auth-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.auth-tab { flex: 1; text-align: center; padding: 10px; font-weight: 600; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--text-muted); transition: all 0.2s; background: none; border-left: none; border-right: none; border-top: none; font-family: inherit; }
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-error { background: var(--red-light); color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: none; }

/* Empty / Toast */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state p { font-size: 14px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: white; padding: 14px 24px; border-radius: 10px; font-size: 14px; font-weight: 500; transform: translateY(80px); opacity: 0; transition: all 0.3s cubic-bezier(0.16,1,0.3,1); z-index: 300; box-shadow: var(--shadow-lg); }
.toast.show { transform: translateY(0); opacity: 1; }

/* Demo box */
.demo-box { margin-top: 24px; padding: 20px; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); }
.demo-box h3 { font-size: 14px; font-weight: 600; color: #92400e; margin-bottom: 12px; }
.demo-box .demo-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.demo-box .demo-result { margin-top: 10px; font-size: 13px; color: #92400e; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .dash-sidebar { display: none; }
  .dash-main { padding: 20px 16px; }
  .site-nav .container { padding: 0 16px; height: 60px; }
  .container { padding: 0 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .nav-link { display: none; }
}
