/* Base Variables */
:root {
  --fioblue: #00458A;
  --fioblue-dark: #003366;
  --fioblue-light: #e6f0fa;
  --fiogreen: #8FBE00;
  --fiogreen-dark: #75a000;
  --fiogreen-light: #f3f9e6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 0.5rem;
}

/* Base styles */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--gray-800);
  background-color: var(--gray-50);
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--gray-900);
}

h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

a {
  color: var(--fioblue);
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

a:hover {
  color: var(--fioblue-dark);
}

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

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
header {
  background-color: var(--fioblue);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  color: white;
  text-decoration: none;
}

.logo-image {
  height: 60px;
  width: auto;
}

/* Navigation */
nav.desktop-menu {
  display: flex;
}

nav.desktop-menu a {
  position: relative;
  color: rgba(255, 255, 255, 0.9);
  padding: 0.625rem 1rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

nav.desktop-menu a:after {
  content: '';
  position: absolute;
  width: 0;
  height: 3px;
  bottom: 0;
  left: 50%;
  background-color: var(--fiogreen);
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

nav.desktop-menu a:hover {
  color: white;
}

nav.desktop-menu a:hover:after {
  width: 70%;
}

/* Mobile menu */
.mobile-menu-button {
  display: none;
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: white;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  background-color: var(--fioblue);
  padding: 1rem 0;
}

.mobile-menu a {
  color: white;
  padding: 0.75rem 1rem;
  text-decoration: none;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu.active {
  display: flex;
}

/* Date banner */
.date-banner {
  background-color: var(--fiogreen);
  color: white;
  text-align: center;
  padding: 0.625rem;
  font-weight: 600;
  font-size: 1rem;
}

/* Main content */
main {
  padding: 1.5rem 0;
}

/* Cards */
.card {
  background-color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Card header with button */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--fioblue);
  color: white;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1.125rem;
}

.card-header-button {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.card-header-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.card-body {
  padding: 1.0rem;
}

/* Grid layout */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

th {
  background-color: var(--fioblue-light);
  color: var(--fioblue);
  font-weight: 600;
}

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

/* Action column alignment - right aligned only for action columns */
.action-column {
  text-align: right;
  width: 260px;
  min-width: 260px;
}

.table-header {
  background-color: var(--fioblue);
  color: white;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1.125rem;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.table-footer {
  padding: 1rem;
  border-top: 1px solid var(--gray-200);
  text-align: right;
}

/* Restaurant links in tables */
.restaurant-item {
  display: inline-block;
  position: relative;
  padding: 2px 4px;
  border-radius: 3px;
}

.restaurant-item:hover {
  background-color: transparent;
}

.restaurant-link {
  position: relative;
  transition: color 0.2s ease;
}

.restaurant-link:hover {
  color: #e53e3e !important; /* Using red color and important to override any other styles */
  text-decoration: none; /* Ensure no underline appears */
}

/* Remove any code that disables the hover background */
tr:hover td {
  background-color: transparent;
}

/* Separator styling */
.separator {
  color: var(--gray-400);
  margin: 0 4px;
}

/* Count badge */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--fiogreen-light);
  color: var(--fiogreen-dark);
  font-weight: 600;
  min-width: 28px;
  height: 28px;
  padding: 0 0.5rem;
  border-radius: 14px;
  font-size: 0.875rem;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-active {
  background-color: var(--fiogreen-light);
  color: var(--fiogreen-dark);
}

.status-inactive {
  background-color: #FEE2E2;
  color: #B91C1C;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

select, input[type="text"] {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  font-size: 1rem;
  color: var(--gray-800);
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--fioblue);
  box-shadow: 0 0 0 3px rgba(0, 69, 138, 0.1);
}

/* Custom select styling */
.custom-select-container {
  position: relative;
}

.custom-select {
  appearance: none;
  background-color: white;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  padding-right: 2.5rem;
  width: 100%;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select:focus {
  outline: none;
  border-color: var(--fioblue);
  box-shadow: 0 0 0 3px rgba(0, 69, 138, 0.1);
}

.name-selection {
  max-width: 400px;
}

/* Restaurant selection styling - no scrollbar */
.restaurant-selection {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background-color: white;
  max-height: none;    /* Remove max height limitation */
  overflow-y: visible; /* Remove scroll behavior */
}

.restaurant-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.restaurant-option {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  transition: background-color 0.2s;
}

.restaurant-option:last-child {
  border-bottom: none;
}

.restaurant-option:hover {
  background-color: var(--fioblue-light);
}

.restaurant-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 0.75rem;
  accent-color: var(--fiogreen);
  cursor: pointer;
}

.restaurant-option input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.restaurant-option:has(input[type="checkbox"]:disabled) {
  opacity: 0.6;
  background-color: var(--gray-100);
}

.restaurant-option:has(input[type="checkbox"]:disabled):hover {
  background-color: var(--gray-100);
}

.restaurant-option input[type="checkbox"]:disabled + label {
  cursor: not-allowed;
  color: var(--gray-500);
}

.restaurant-option label {
  margin-bottom: 0;
  cursor: pointer;
  font-weight: normal;
  flex: 1;
}

/* Alerts */
.alert {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
}

.alert-info {
  background-color: var(--fioblue-light);
  color: var(--fioblue);
  border-left: 4px solid var(--fioblue);
}

.alert-danger {
  background-color: #FEE2E2;
  color: #B91C1C;
  border-left: 4px solid #B91C1C;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-success {
  background-color: var(--fiogreen);
  color: white;
}

.btn-success:hover {
  background-color: var(--fiogreen-dark);
  color: white;
}

.btn-primary {
  background-color: var(--fioblue);
  color: white;
}

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

.btn-danger {
  background-color: #EF4444;
  color: white;
}

.btn-danger:hover {
  background-color: #B91C1C;
  color: white;
}

.btn-warning {
  background-color: #F59E0B;
  color: white;
}

.btn-warning:hover {
  background-color: #D97706;
  color: white;
}

/* Fixed width action buttons */
.btn-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  width: 80px;         /* Fixed width for consistent button sizing */
  text-align: center;  /* Center the text within button */
}

.btn-sm:hover {
  color: white;
}

.btn-lunch {
  font-size: 1.125rem;
  padding: 0.75rem 2rem;
  min-width: 200px;
}

/* Form actions area */
.form-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.button-container {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

/* Action buttons - right aligned */
.action-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;  /* Align buttons to the right */
}

/* Empty state message */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
}

.empty-state p {
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

.empty-state .emoji {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

/* Hidden row */
.hidden-row {
  color: var(--gray-500);
}

/* Debug banner */
.debug-banner {
  background-color: #fef3c7;
  color: #92400e;
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  border-bottom: 1px solid #f59e0b;
}

.debug-link {
  display: inline-block;
  margin-left: 1rem;
  padding: 0.25rem 0.75rem;
  background-color: #f59e0b;
  color: white;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
}

.debug-link:hover {
  background-color: #d97706;
  color: white;
}

/* Footer */
footer {
  background-color: var(--fioblue);
  color: rgba(255, 255, 255, 0.8);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.875rem;
  margin-top: 2rem;
}

/* Form Tables Styling */
.form-table {
  width: 100%;
  margin-bottom: 0;
}

.form-table td {
  padding: 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-200);
}

.form-table td:first-child {
  width: 30%;
  font-weight: 500;
}

.form-table td:last-child {
  width: 20%;
  color: var(--fioblue);
}

.form-table .actions-cell {
  text-align: center;
  padding-top: 1.5rem;
  border-bottom: none;
}

.form-table .form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
}

.form-table .checkbox-control {
  width: 20px;
  height: 20px;
  accent-color: var(--fiogreen);
}

/* Statistics Page Styling */
.top-three-list, .favorites-list {
  list-style-position: inside;
  padding-left: 0;
  margin-bottom: 0;
}

.top-three-list li, .favorites-list li {
  margin-bottom: 0.5rem;
}

.top-three-list li:last-child, .favorites-list li:last-child {
  margin-bottom: 0;
}

.count-mini-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
  background-color: var(--gray-100);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
}

.date-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  background-color: var(--fioblue);
  padding: 0.25rem 0.5rem;
  border-radius: 10px;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Restaurant Trend Styles */
.trend-badge {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.85rem;
}

.trend-up {
  background-color: #d4edda;
  color: #155724;
}

.trend-down {
  background-color: #f8d7da;
  color: #721c24;
}

.trend-stable {
  background-color: #e2e3e5;
  color: #383d41;
}

.trend-icon {
  font-style: normal;
  margin-right: 4px;
}

.positive-change {
  color: #28a745;
  font-weight: 500;
}

.negative-change {
  color: #dc3545;
  font-weight: 500;
}

/* User Compatibility Styles */
.compatibility-meter {
  position: relative;
  width: 100%;
  height: 20px;
  background-color: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

.compatibility-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #8FBE00 0%, #00458A 100%);
  border-radius: 10px;
}

.compatibility-text {
  position: absolute;
  width: 100%;
  text-align: center;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 20px;
  text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* Visit Pattern Stats Styles */
.visit-summary {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.visit-stat {
  text-align: center;
  padding: 1rem;
  border-radius: 8px;
  background-color: #f8f9fa;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  min-width: 150px;
  margin: 0 0.5rem 1rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--fioblue);
}

.stat-percentage {
  font-size: 1rem;
  font-weight: 500;
}

.sub-stats {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.5rem;
}

.stats-half {
  flex: 1 1 400px;
  margin: 0 0.5rem 1rem;
  min-width: 0;
}

.stats-half h3 {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
  color: var(--fioblue);
}

.stat-description {
  color: var(--gray-600);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.stats-half table {
  width: 100%;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .stats-half {
    flex: 1 1 100%;
  }
}

/* Collapsible sections */
.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.collapsible-header:hover {
  background-color: rgba(0, 69, 138, 0.9);
}

.toggle-icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.collapsible-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.collapsible-content.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Expand/Collapse All Buttons */
.expand-collapse-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--fioblue);
  color: var(--fioblue);
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  transition: all 0.2s;
}

.btn-outline:hover {
  background-color: var(--fioblue);
  color: white;
}

/* Form validation styles */
.required-mark {
  color: #e53e3e;
  font-weight: bold;
  margin-left: 4px;
}

.validation-message {
  color: #e53e3e;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Restaurant options loading state */
.restaurant-selection.loading {
  position: relative;
  opacity: 0.7;
  pointer-events: none;
}

.restaurant-selection.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid rgba(0, 69, 138, 0.3);
  border-radius: 50%;
  border-top-color: var(--fioblue);
  animation: spin 1s ease-in-out infinite;
}

/* Loading label effect for checkboxes */
.loading-label {
  position: relative;
  color: #ccc;
}

.loading-label::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, var(--fioblue), var(--fiogreen), var(--fioblue));
  background-size: 200% 100%;
  animation: loading-gradient 1.5s infinite;
}

@keyframes loading-gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Helper class */
.hidden {
  display: none !important;
}

/* Button loading state */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

/* Media Queries */
@media (max-width: 768px) {
  .mobile-menu-button {
    display: block;
  }
  
  nav.desktop-menu {
    display: none;
  }
  
  .header-content {
    flex-wrap: wrap;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .card-header {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    padding: 0.75rem 1rem;
  }
  
  .action-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .custom-select, 
  select, 
  input[type="text"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Mobile adjustments for fixed-width buttons */
  .btn-sm {
    width: 70px;
    font-size: 0.7rem;
  }
  
  .action-column {
    width: 230px;
    min-width: 230px;
  }
}

.participation-percentage {
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.high-participation {
  background-color: var(--fiogreen-light);
  color: var(--fiogreen-dark);
}

.medium-participation {
  background-color: #FEF3C7;
  color: #92400E;
}

.low-participation {
  background-color: #FEE2E2;
  color: #B91C1C;
}
