/* ============================================
   RigSize Live - Watersports Theme Stylesheet
   ============================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  background: linear-gradient(135deg, #ecfeff 0%, #dbeafe 100%);
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header Styles */
.header {
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.header-content {
  padding: 1.5rem 1rem 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.subtitle {
  font-size: 0.75rem;
  color: #a5f3fc;
  margin: 0;
}

.icon-large {
  width: 2rem;
  height: 2rem;
}

.icon-button {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
  color: white;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.icon-button i {
  width: 1.5rem;
  height: 1.5rem;
}

/* View Selector Dropdown */
.view-selector {
  position: relative;
}

.view-dropdown-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
  min-height: 48px;
}

.view-dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.view-dropdown-btn i {
  width: 1.25rem;
  height: 1.25rem;
}

.chevron-icon {
  margin-left: 0.25rem;
  transition: transform 0.2s;
}

.view-dropdown-btn.open .chevron-icon {
  transform: rotate(180deg);
}

.view-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  min-width: 180px;
  overflow: hidden;
  z-index: 1000;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s, transform 0.2s;
}

.view-dropdown.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.dropdown-item {
  width: 100%;
  background: none;
  border: none;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
  text-align: left;
}

.dropdown-item:hover {
  background: #f1f5f9;
}

.dropdown-item.active {
  background: #e0f2fe;
  color: #0891b2;
}

.dropdown-item i {
  width: 1.25rem;
  height: 1.25rem;
  color: currentColor;
}

/* Welcome Screen */
.welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.welcome-screen.hidden {
  display: none;
}

.welcome-content {
  background: white;
  border-radius: 1.5rem;
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  margin: auto;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.welcome-icon i {
  width: 36px;
  height: 36px;
  color: white;
}

.welcome-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  margin: 0 0 0.25rem 0;
}

.welcome-subtitle {
  font-size: 0.875rem;
  color: #0891b2;
  text-align: center;
  margin: 0 0 1.5rem 0;
  font-weight: 500;
}

.welcome-explanation {
  background: #f8fafc;
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.welcome-explanation h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.5rem 0;
}

.welcome-explanation p {
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
}

.welcome-benefits {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 500;
}

.benefit-item i {
  width: 1.25rem;
  height: 1.25rem;
  color: #0891b2;
  flex-shrink: 0;
}

.welcome-form h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
}

.form-help {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0 0 1rem 0;
  line-height: 1.4;
}

.welcome-form .input-group {
  margin-bottom: 1rem;
}

.welcome-form .input-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.welcome-form .input-group label i {
  width: 1rem;
  height: 1rem;
  color: #64748b;
}

.btn-large {
  padding: 0.875rem;
  font-size: 1rem;
  width: 100%;
}

@media (max-height: 700px) {
  .welcome-content {
    padding: 1rem;
  }
  
  .welcome-icon {
    width: 56px;
    height: 56px;
  }
  
  .welcome-icon i {
    width: 32px;
    height: 32px;
  }
  
  .welcome-content h1 {
    font-size: 1.25rem;
  }
  
  .welcome-explanation {
    padding: 0.875rem;
    margin-bottom: 1rem;
  }
  
  .welcome-explanation p {
    margin-bottom: 0.75rem;
  }
}

/* Stats Bar */
.stats-bar {
  padding: 0 1rem 0.75rem 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.stat-label {
  color: #a5f3fc;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-unit {
  font-size: 0.875rem;
}

/* Main Content */
.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.view-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* Map Styles */
.map-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* Session Panel */
.session-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1rem 1.5rem;
  background: linear-gradient(to top, white 70%, transparent);
  z-index: 1000;
  pointer-events: none;
}

.session-card {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 1rem;
  pointer-events: auto;
}

.session-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Input Styles */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.input-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 1.125rem;
  transition: all 0.2s;
  outline: none;
}

.input-group input:focus {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

/* Button Styles */
.btn {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn i {
  width: 1.25rem;
  height: 1.25rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 10px 15px -3px rgba(8, 145, 178, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 20px 25px -5px rgba(8, 145, 178, 0.4);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #e11d48 100%);
  color: white;
  box-shadow: 0 10px 15px -3px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 20px 25px -5px rgba(220, 38, 38, 0.4);
  transform: translateY(-1px);
}

/* Session Status */
.session-status {
  text-align: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #d1fae5;
  color: #065f46;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-pulse {
  width: 0.5rem;
  height: 0.5rem;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Settings View */
.settings-container {
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  background: linear-gradient(135deg, #ecfeff 0%, #dbeafe 100%);
  position: relative;
  z-index: 2000;
}

.settings-card {
  max-width: 28rem;
  margin: 0 auto 8rem;
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.settings-icon {
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.settings-icon i {
  width: 1.5rem;
  height: 1.5rem;
}

.settings-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.settings-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Info Box */
.info-box {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-top: 0.5rem;
}

.info-box h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e3a8a;
  margin: 0 0 0.5rem 0;
}

.info-box p {
  font-size: 0.75rem;
  color: #1e40af;
  line-height: 1.5;
  margin: 0;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
  margin: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
  .header-content {
    padding: 0.75rem 1rem;
  }
  
  .header-title h1 {
    font-size: 1.125rem;
  }
  
  .stat-value {
    font-size: 1.75rem;
  }
  
  .session-panel {
    padding: 0.75rem 0.75rem 1.25rem;
  }
}

/* Prevent zoom on input focus (iOS) */
@media screen and (max-width: 767px) {
  input[type="text"],
  input[type="number"] {
    font-size: 16px;
  }
}

/* List View */
.list-container {
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  background: linear-gradient(135deg, #ecfeff 0%, #dbeafe 100%);
}

.list-header {
  margin-bottom: 1.5rem;
}

.list-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
}

.list-subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
}

.surfers-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 2rem;
}

.surfer-card {
  background: white;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.surfer-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.surfer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.surfer-avatar.own-marker {
  border: 3px solid #fbbf24;
}

.surfer-info {
  flex: 1;
  min-width: 0;
}

.surfer-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.you-badge {
  background: #fbbf24;
  color: #78350f;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.surfer-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
}

.surfer-detail {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.625rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.125rem;
}

.detail-value {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.875rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1rem;
  font-weight: 500;
}

/* Safe area support for iOS */
@supports (padding: max(0px)) {
  .header-content {
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  .stats-bar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  .session-panel {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
}