/* ============================================================
   Sunshine Agent — Styles
   Florida Public Records Request Assistant
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --color-sun-50:  #FFFBEB;
  --color-sun-100: #FEF3C7;
  --color-sun-200: #FDE68A;
  --color-sun-300: #FCD34D;
  --color-sun-400: #FBBF24;
  --color-sun-500: #F59E0B;
  --color-sun-600: #D97706;
  --color-sun-700: #B45309;

  --color-sky-50:  #F0F9FF;
  --color-sky-100: #E0F2FE;
  --color-sky-200: #BAE6FD;
  --color-sky-400: #38BDF8;
  --color-sky-500: #0EA5E9;
  --color-sky-600: #0284C7;
  --color-sky-700: #0369A1;

  --color-green-50:  #F0FDF4;
  --color-green-100: #DCFCE7;
  --color-green-500: #22C55E;
  --color-green-600: #16A34A;
  --color-green-700: #15803D;

  --color-red-50:  #FEF2F2;
  --color-red-100: #FEE2E2;
  --color-red-500: #EF4444;
  --color-red-600: #DC2626;
  --color-red-700: #B91C1C;

  --color-orange-50:  #FFF7ED;
  --color-orange-500: #F97316;
  --color-orange-600: #EA580C;

  --color-purple-50:  #FAF5FF;
  --color-purple-500: #A855F7;
  --color-purple-600: #9333EA;

  --color-gray-50:  #F9FAFB;
  --color-gray-100: #F3F4F6;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #1F2937;
  --color-gray-900: #111827;

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10);
  --transition: 0.2s ease;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--color-gray-800);
  background: var(--color-gray-50);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--color-sky-600); text-decoration: none; }
a:hover { color: var(--color-sky-700); }

img { max-width: 100%; height: auto; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-sun-400);
}
.logo i { font-size: 1.4rem; }

.sidebar-close {
  display: none;
  background: none; border: none;
  color: var(--color-gray-400);
  font-size: 1.25rem;
  cursor: pointer;
}
.sidebar-close:hover { color: #fff; }

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--color-gray-400);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}
.nav-link.active {
  color: var(--color-sun-400);
  background: rgba(251,191,36,0.08);
  border-left-color: var(--color-sun-400);
}
.nav-link i { width: 20px; text-align: center; font-size: 1.05rem; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  color: var(--color-gray-500);
  line-height: 1.5;
}
.legal-note { font-style: italic; margin-top: 2px; }

/* --- Nav Overlay (mobile) --- */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition);
}
.nav-overlay.visible { display: block; opacity: 1; }

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Bar --- */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.hamburger {
  display: none;
  background: none; border: none;
  font-size: 1.3rem;
  color: var(--color-gray-600);
  cursor: pointer;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-gray-800);
  white-space: nowrap;
}

.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* --- Page Container --- */
.page-container {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.btn-primary { background: var(--color-sky-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-sky-700); }

.btn-success { background: var(--color-green-600); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--color-green-700); }

.btn-warning { background: var(--color-sun-500); color: #fff; }
.btn-warning:hover:not(:disabled) { background: var(--color-sun-600); }

.btn-danger { background: var(--color-red-500); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--color-red-600); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-gray-300);
  color: var(--color-gray-700);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--color-sky-500);
  color: var(--color-sky-600);
  background: var(--color-sky-50);
}

.btn-ghost {
  background: transparent;
  color: var(--color-gray-600);
  padding: 8px 12px;
}
.btn-ghost:hover:not(:disabled) { background: var(--color-gray-100); color: var(--color-gray-800); }

/* --- Cards --- */
.card {
  background: #fff;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2, .card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-gray-800);
}

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-gray-100);
  background: var(--color-gray-50);
}

/* --- Stat Cards --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-icon.blue  { background: var(--color-sky-100); color: var(--color-sky-600); }
.stat-icon.amber { background: var(--color-sun-100); color: var(--color-sun-600); }
.stat-icon.green { background: var(--color-green-100); color: var(--color-green-600); }
.stat-icon.red   { background: var(--color-red-100); color: var(--color-red-600); }
.stat-icon.purple { background: var(--color-purple-50); color: var(--color-purple-600); }

.stat-content { flex: 1; min-width: 0; }
.stat-label { font-size: 0.78rem; font-weight: 500; color: var(--color-gray-500); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--color-gray-900); line-height: 1.2; margin-top: 2px; }
.stat-sub { font-size: 0.8rem; color: var(--color-gray-500); margin-top: 2px; }

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--color-gray-400);
  margin-top: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid var(--color-gray-300);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-sky-500);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--color-gray-400); }

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

.form-select { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--color-sky-600);
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-gray-500);
  background: var(--color-gray-50);
  border-bottom: 2px solid var(--color-gray-200);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-gray-100);
  color: var(--color-gray-700);
  vertical-align: top;
}
.table tr:hover td { background: var(--color-gray-50); }
.table td.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-blue   { background: var(--color-sky-100); color: var(--color-sky-700); }
.badge-amber  { background: var(--color-sun-100); color: var(--color-sun-700); }
.badge-green  { background: var(--color-green-100); color: var(--color-green-700); }
.badge-red    { background: var(--color-red-100); color: var(--color-red-700); }
.badge-gray   { background: var(--color-gray-100); color: var(--color-gray-600); }
.badge-orange { background: var(--color-orange-50); color: var(--color-orange-600); }
.badge-purple { background: var(--color-purple-50); color: var(--color-purple-600); }

/* --- Pipeline (Kanban-style) --- */
.pipeline {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.pipeline-col {
  min-width: 260px;
  max-width: 320px;
  flex: 1;
  background: var(--color-gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-200);
  display: flex;
  flex-direction: column;
}
.pipeline-col-header {
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--color-gray-200);
}
.pipeline-col-header .count {
  background: var(--color-gray-200);
  color: var(--color-gray-600);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
}
.pipeline-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 60px;
}
.pipeline-card {
  background: #fff;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.pipeline-card:hover { box-shadow: var(--shadow-md); }
.pipeline-card-id {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-sky-600);
  margin-bottom: 4px;
}
.pipeline-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-gray-800);
  margin-bottom: 6px;
  line-height: 1.3;
}
.pipeline-card-meta {
  font-size: 0.75rem;
  color: var(--color-gray-500);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-gray-200);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--color-gray-700); }
.tab-btn.active {
  color: var(--color-sky-600);
  border-bottom-color: var(--color-sky-600);
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}
.modal-backdrop.open { opacity: 1; visibility: visible; }

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-backdrop.open .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none;
  font-size: 1.25rem;
  color: var(--color-gray-400);
  cursor: pointer;
}
.modal-close:hover { color: var(--color-gray-700); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Toasts --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--color-gray-800);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  min-width: 260px;
  max-width: 400px;
}
.toast.success { background: var(--color-green-600); }
.toast.error   { background: var(--color-red-600); }
.toast.warning { background: var(--color-sun-600); }

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

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-gray-400);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--color-gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; margin-bottom: 20px; }

/* --- Hero (Landing Page) --- */
.hero {
  background: linear-gradient(135deg, var(--color-sky-600) 0%, var(--color-sky-700) 50%, var(--color-gray-900) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  top: -40%; right: -10%;
  width: 400px; height: 400px;
  background: rgba(251,191,36,0.12);
  border-radius: 50%;
  pointer-events: none;
}
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; position: relative; z-index: 1; }
.hero p  { font-size: 1.1rem; opacity: 0.9; max-width: 600px; line-height: 1.6; position: relative; z-index: 1; }
.hero-actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }

/* --- Feature Grid --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.feature-card {
  background: #fff;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all var(--transition);
  cursor: pointer;
}
.feature-card:hover {
  border-color: var(--color-sky-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.feature-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--color-gray-800); }
.feature-card p  { font-size: 0.88rem; color: var(--color-gray-500); line-height: 1.5; }

/* --- Search / Filter Bar --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}
.filter-bar .form-input,
.filter-bar .form-select {
  max-width: 240px;
  padding: 8px 12px;
  font-size: 0.85rem;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.search-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gray-400);
  font-size: 0.85rem;
}
.search-input-wrap .form-input { padding-left: 36px; }

/* --- Chart Container --- */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* --- Section Title --- */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-gray-800);
  margin-bottom: 16px;
}

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* --- Scope Option Cards --- */
.scope-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.scope-card {
  border: 2px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.scope-card:hover { border-color: var(--color-sky-400); }
.scope-card.selected { border-color: var(--color-sky-600); background: var(--color-sky-50); }
.scope-card h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.scope-card p  { font-size: 0.82rem; color: var(--color-gray-500); }

/* --- Timeline --- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: var(--color-gray-200);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-sky-500);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--color-sky-200);
}
.timeline-date { font-size: 0.75rem; font-weight: 600; color: var(--color-gray-400); margin-bottom: 2px; }
.timeline-text { font-size: 0.88rem; color: var(--color-gray-700); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .nav-overlay { display: block; }

  .main-content { margin-left: 0; }

  .hamburger { display: block; }

  .topbar { padding: 0 16px; }
  .page-container { padding: 16px; }

  .btn-label { display: none; }
  .btn-sm { padding: 8px 10px; }

  .hero { padding: 32px 24px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.95rem; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .feature-grid { grid-template-columns: 1fr; }

  .pipeline { flex-direction: column; }
  .pipeline-col { min-width: 100%; max-width: 100%; }

  .filter-bar .form-input,
  .filter-bar .form-select { max-width: 100%; }
  .search-input-wrap { max-width: 100%; }

  .chart-container { height: 250px; }

  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: auto; width: 100%; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .scope-cards { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.3rem; }
  .stat-value { font-size: 1.5rem; }
}
