/*!
 * Bootstrap Custom Theme for City Discovery
 * Bootstrap 5.3 customizations and brand-specific styling
 */

/* ================================================
   CSS Custom Properties (Brand Colors)
   ================================================ */
:root {
  /* Brand Colors - matching existing design */
  --primary: #667eea;
  --secondary: #764ba2;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
  --light: #f8f9fa;
  --dark: #343a40;
  
  /* Custom Brand Variables */
  --gradient-bg: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --card-shadow: 0 10px 30px rgba(0,0,0,0.2);
  --card-radius: 15px;
  --btn-radius: 25px;
  
  /* Bootstrap Color Overrides */
  --bs-primary: var(--primary);
  --bs-secondary: var(--secondary);
  --bs-success: var(--success);
  --bs-danger: var(--danger);
  --bs-warning: var(--warning);
  --bs-info: var(--info);
  --bs-light: var(--light);
  --bs-dark: var(--dark);
  
  /* Typography */
  --bs-font-family-sans-serif: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  
  /* Spacing for consistent margins/padding */
  --game-spacing: 1rem;
  --card-padding: 1.875rem; /* 30px */
}

/* ================================================
   Global Body Styling
   ================================================ */
body {
  background: var(--gradient-bg);
  font-family: var(--bs-font-family-sans-serif);
  min-height: 100vh;
  color: #333;
}

/* ================================================
   Bootstrap Component Overrides
   ================================================ */

/* Cards - maintain existing design */
.card {
  border-radius: var(--card-radius) !important;
  box-shadow: var(--card-shadow) !important;
  border: none;
  margin-bottom: var(--game-spacing);
}

.card-body {
  padding: var(--card-padding);
}

/* Buttons - gradient primary buttons */
.btn-primary {
  background: var(--gradient-bg) !important;
  border: none !important;
  border-radius: var(--btn-radius) !important;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary buttons */
.btn-secondary {
  border-radius: var(--btn-radius) !important;
  background: #6c757d !important;
  border: none !important;
}

/* Form controls */
.form-control {
  border-radius: 10px !important;
  border: 2px solid #e9ecef;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
}

/* Labels */
.form-label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
}

/* ================================================
   Custom Layout Components
   ================================================ */

/* Main container for game */
.game-container {
  max-width: 100%;
  margin: 0 auto;
  padding: var(--game-spacing);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Standard centered container */
.centered-container {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  padding: var(--game-spacing);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Wide container for admin/dashboard */
.wide-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: var(--game-spacing);
}

/* ================================================
   Brand-Specific Components
   ================================================ */

/* Logo styling */
.logo {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Subtitle styling */
.subtitle {
  color: #666;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

/* Team color picker */
.color-picker {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: var(--primary);
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--primary);
}

/* Game mode selector */
.mode-option {
  display: flex;
  align-items: center;
  padding: 1rem;
  margin: 0.75rem 0;
  border: 2px solid #e1e1e1;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  background: white;
}

.mode-option:hover {
  border-color: var(--primary);
  background: #f0f4ff;
}

.mode-option.active {
  border-color: var(--primary);
  background: #e8f0fe;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.mode-icon {
  font-size: 2rem;
  margin-right: 1rem;
  min-width: 50px;
  text-align: center;
}

/* ================================================
   Loading and Status States
   ================================================ */

/* Loading spinner */
.loading {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Status messages */
.success-message {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.error-message {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.waiting-message {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  text-align: center;
}

/* ================================================
   Team and Score Components
   ================================================ */

.team-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  margin: 0.5rem 0;
  background: white;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.team-item:hover {
  background: #f8f9fa;
}

.team-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.team-name {
  flex-grow: 1;
  font-weight: 500;
}

.host-badge {
  background: var(--warning);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
}

/* ================================================
   Game-Specific Components
   ================================================ */

/* Session code display */
.session-code {
  background: rgba(255,255,255,0.9);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--primary);
  margin: 0.5rem 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Scoreboard */
.scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.score-item {
  background: rgba(255,255,255,0.9);
  padding: 0.75rem;
  border-radius: 8px;
  text-align: center;
}

.score-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
}

.score-label {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.25rem;
}

/* ================================================
   Responsive Design
   ================================================ */

/* Mobile optimizations */
@media (max-width: 576px) {
  .card-body {
    padding: 1.5rem;
  }
  
  .logo {
    font-size: 2rem;
  }
  
  .color-option {
    width: 35px;
    height: 35px;
  }
  
  .mode-option {
    padding: 0.75rem;
  }
  
  .mode-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    min-width: 40px;
  }
  
  .scoreboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet optimizations */
@media (min-width: 577px) and (max-width: 768px) {
  .wide-container {
    padding: 1.5rem;
  }
}

/* Desktop optimizations */
@media (min-width: 992px) {
  .scoreboard {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ================================================
   Unified Layout Classes - V2024
   ================================================ */

/* Enhanced mode styling - removed radio selector, now using simple .game-mode-option */

/* GPS button styling without icons */
.gps-center-button {
  font-size: 0.85rem !important;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
  letter-spacing: 0.5px;
}

/* Consistent alert styling without icons */
.alert {
  display: flex;
  align-items: center;
  text-align: left;
  padding-left: 1rem;
}

.alert span:first-child {
  flex: 1;
}

/* Enhanced button consistency across all pages */
.btn {
  font-weight: 500;
  border-radius: 8px !important;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
}

.btn:not(.btn-sm):not(.btn-lg) {
  min-height: 44px;
}

/* Unified spacing for button groups */
.d-grid.gap-3 > .btn,
.d-grid.gap-2 > .btn {
  margin-bottom: 0.5rem;
}

.d-grid.gap-3 > .btn:last-child,
.d-grid.gap-2 > .btn:last-child {
  margin-bottom: 0;
}

/* Enhanced compact form components */
.config-option,
.game-mode-option {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
  transition: all 0.2s ease !important;
  border-radius: 6px !important;
}

.config-option:hover,
.game-mode-option:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15) !important;
}

/* Compact spacing for form sections */
.mb-3 {
  margin-bottom: 1rem !important;
}

.form-label {
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.5rem !important;
  color: #495057 !important;
}

/* Enhanced responsive container for unified experience */
@media (max-width: 768px) {
  .container-fluid.p-2 .col-md-8.col-lg-6 {
    max-width: 100%;
    padding: 0 0.5rem;
  }
  
  .card {
    border-radius: 12px !important;
  }
  
  .btn {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }
  
  /* Mobile compact adjustments */
  .config-option,
  .game-mode-option {
    padding: 8px 10px !important;
    margin: 4px 0 !important;
  }
}

/* ================================================
   Utility Classes
   ================================================ */

/* Background utilities */
.bg-gradient-primary {
  background: var(--gradient-bg) !important;
}

/* Text utilities */
.text-primary-custom {
  color: var(--primary) !important;
}

/* Spacing utilities that complement Bootstrap */
.mb-game {
  margin-bottom: var(--game-spacing) !important;
}

.p-game {
  padding: var(--game-spacing) !important;
}

/* Shadow utilities */
.shadow-custom {
  box-shadow: var(--card-shadow) !important;
}

/* Border radius utilities */
.rounded-custom {
  border-radius: var(--card-radius) !important;
}

.rounded-btn {
  border-radius: var(--btn-radius) !important;
}