/* FranchiseStack App Styles */
:root {
  --navy: #1A237E;
  --navy-light: #283593;
  --navy-dark: #0D1642;
  --orange: #F57C00;
  --orange-light: #FF9800;
  --orange-dark: #E65100;
  --green: #2E7D32;
  --green-light: #4CAF50;
  --red: #C62828;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-400: #BDBDBD;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-weight: 600;
  line-height: 1.3;
}

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--navy-dark);
  color: white;
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}

.sidebar-brand h1 {
  font-size: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand h1 span { color: var(--orange); }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}

.sidebar-nav a.active {
  color: white;
  background: rgba(255,255,255,0.1);
  border-left-color: var(--orange);
}

.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-section {
  padding: 16px 24px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: var(--navy-dark);
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.sidebar-footer .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
}

.sidebar-footer .user-name {
  font-size: 13px;
  color: white;
  font-weight: 500;
}

.sidebar-footer .user-email {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.sidebar-footer .logout-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.sidebar-footer .logout-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

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

.card-header h2 { font-size: 18px; }
.card-header h3 { font-size: 16px; color: var(--gray-700); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--orange);
  color: white;
}
.btn-primary:hover { background: var(--orange-dark); }

.btn-secondary {
  background: var(--navy);
  color: white;
}
.btn-secondary:hover { background: var(--navy-dark); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--navy);
}

.stat-card .stat-value.orange { color: var(--orange); }
.stat-card .stat-value.green { color: var(--green); }

/* Score Badge */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 18px;
  font-family: 'Space Grotesk', sans-serif;
}

.score-badge.high { background: #E8F5E9; color: var(--green); }
.score-badge.medium { background: #FFF3E0; color: var(--orange); }
.score-badge.low { background: #FFEBEE; color: var(--red); }

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-bar .fill.navy { background: var(--navy); }
.progress-bar .fill.orange { background: var(--orange); }
.progress-bar .fill.green { background: var(--green); }

/* Form elements */
.form-group { margin-bottom: 16px; }

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

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

/* Tags / Chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid var(--gray-300);
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}

.chip:hover { border-color: var(--navy); }

.chip.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
}

.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
}

.data-table tr:hover td { background: var(--gray-50); }

/* Match Card */
.match-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  transition: box-shadow 0.15s;
}

.match-card:hover { box-shadow: var(--shadow-md); }

.match-card .match-score { flex-shrink: 0; }

.match-card .match-info { flex: 1; }

.match-card .match-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}

.match-card .match-meta {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.match-card .match-scores {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.match-card .mini-score {
  text-align: center;
}

.match-card .mini-score .label {
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.match-card .mini-score .value {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.match-card .match-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Comparison Table */
.compare-grid {
  display: grid;
  gap: 2px;
  background: var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.compare-row {
  display: grid;
  gap: 2px;
}

.compare-cell {
  background: white;
  padding: 12px 16px;
  font-size: 14px;
}

.compare-cell.header {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-600);
}

.compare-cell.brand-name {
  font-weight: 700;
  color: var(--navy);
  font-size: 16px;
  text-align: center;
  padding: 16px;
}

/* Disclaimer Banner */
.disclaimer-banner {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--gray-700);
  line-height: 1.5;
  margin-bottom: 20px;
}

.disclaimer-banner strong { color: var(--orange-dark); }

/* Wizard Steps */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  overflow-x: auto;
}

.wizard-step {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  border-bottom: 3px solid var(--gray-200);
  min-width: 120px;
}

.wizard-step.active {
  color: var(--navy);
  border-bottom-color: var(--orange);
}

.wizard-step.completed {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--gray-900);
  color: white;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

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

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--gray-400);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { color: var(--gray-700); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* Acknowledgment Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 640px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h2 {
  color: var(--navy);
  margin-bottom: 16px;
  font-size: 20px;
}

.modal .ack-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  align-items: flex-start;
}

.modal .ack-item input[type="checkbox"] {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--navy);
}

.modal .ack-item label {
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-700);
  cursor: pointer;
}

/* Auth Pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
}

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

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

.auth-card .brand h1 {
  font-size: 24px;
  color: var(--navy);
}

.auth-card .brand h1 span { color: var(--orange); }

.auth-card .brand p {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 8px;
}

.auth-card .error-msg {
  background: #FFEBEE;
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.auth-card .auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--gray-500);
}

.auth-card .auth-footer a {
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .match-card { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Franchise Grid */
.franchise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.franchise-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: all 0.15s;
  cursor: pointer;
}

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

.franchise-card .f-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}

.franchise-card .f-industry {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.franchise-card .f-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}

.franchise-card .f-stat-label { color: var(--gray-500); }
.franchise-card .f-stat-value { font-weight: 600; color: var(--gray-800); }

/* Search bar */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--navy);
}

/* Filters */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.filters-bar select {
  padding: 8px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: white;
}

/* Tag */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.tag-food { background: #FFF3E0; color: #E65100; }
.tag-service { background: #E3F2FD; color: #1565C0; }
.tag-fitness { background: #E8F5E9; color: #2E7D32; }
.tag-education { background: #F3E5F5; color: #7B1FA2; }
.tag-retail { background: #FBE9E7; color: #BF360C; }
.tag-automotive { background: #ECEFF1; color: #455A64; }
.tag-health { background: #E0F7FA; color: #00695C; }
.tag-other { background: var(--gray-100); color: var(--gray-600); }

/* ============ Notifications ============ */
.notif-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 15px;
}

.notif-item {
  transition: background 0.15s;
}

.notif-item:hover {
  background: #f8fafc;
}

.notif-unread {
  background: #fafaff;
}

.notif-item:last-child {
  border-bottom: none !important;
}
