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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 30px;
  min-height: calc(100vh - 40px);
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 3px solid #f0f0f0;
}

.header h1 {
  font-size: 2.5rem;
  color: #667eea;
  margin-bottom: 10px;
  font-weight: 700;
}

/* App logo next to title */
.app-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  height: 42px;
  width: auto;
  display: inline-block;
}

.header .subtitle {
  font-size: 1.1rem;
  color: #666;
  font-weight: 500;
}

.mode-badge {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 10px;
}

.mode-badge.edit {
  background: #10b981;
  color: white;
}

.mode-badge.view {
  background: #6366f1;
  color: white;
}

/* Connection Status */
.connection-status {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.connection-status.connected {
  background: #10b981;
  color: white;
}

.connection-status.disconnected {
  background: #ef4444;
  color: white;
}

.connection-status.connecting {
  background: #f59e0b;
  color: white;
}

/* Legend */
.legend {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  padding: 15px 30px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 3px solid transparent;
  min-width: 160px;
  justify-content: center;
}

.legend-item.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.legend-item.clickable:active {
  transform: translateY(0);
}

.legend-item.selected {
  border: 3px solid #333;
  box-shadow: 0 0 0 2px white, 0 0 0 5px #333;
}

.legend-item.non-clickable {
  cursor: default;
  opacity: 0.9;
}

.legend-item.green {
  background: #10b981;
  color: white;
}

.legend-item.orange {
  background: #f59e0b;
  color: white;
}

.legend-item.red {
  background: #ef4444;
  color: white;
}

.legend-icon {
  font-size: 1.3rem;
  margin-right: 10px;
}

/* Skate Grid */
.skate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

/* Section Headers */
.section-header {
  grid-column: 1 / -1;
  font-size: 1.2rem;
  font-weight: 700;
  color: #667eea;
  padding: 10px 0;
  margin-top: 10px;
  border-bottom: 2px solid #e5e7eb;
}

/* Skate Box */
.skate-box {
  aspect-ratio: 1;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border: 3px solid transparent;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.skate-box.clickable:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.skate-box.clickable:active {
  transform: scale(0.98);
}

.skate-box.selected {
  border: 3px solid #333;
  box-shadow: 0 0 0 2px white, 0 0 0 5px #333;
  transform: scale(1.05);
}

.skate-box.non-clickable {
  cursor: default;
}

.skate-box.green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.skate-box.orange {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.skate-box.red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Loading State */
.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: #666;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Instructions */
.instructions {
  background: #f3f4f6;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: center;
}

.instructions h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.instructions p {
  color: #666;
  font-size: 1rem;
  line-height: 1.6;
}

.instructions.edit {
  border-left: 5px solid #10b981;
}

.instructions.view {
  border-left: 5px solid #6366f1;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 20px;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .skate-grid {
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 10px;
  }
  
  .skate-box {
    min-height: 65px;
    font-size: 1.1rem;
  }
  
  .legend {
    flex-direction: column;
    gap: 10px;
  }
  
  .legend-item {
    width: 100%;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  /* Compact tablet layout (~10") */
  body {
    padding: 14px; /* ~30% less than 20px landscape rule */
  }
  .container {
    padding: 20px; /* -33% from 30px */
  }
  .header {
    margin-bottom: 18px; /* tighter header */
    padding-bottom: 12px;
  }
  .header h1 {
    font-size: 1.7rem; /* slightly smaller title to fit */
  }
  .subtitle { font-size: 1rem; }
  .legend {
    gap: 10px;
    margin-bottom: 18px;
  }
  .legend-item {
    padding: 10px 18px; /* -30% */
    font-size: 1rem; /* slightly smaller text */
    min-width: 130px; /* narrower buttons */
  }
  .skate-grid {
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 9px; /* -25% gap */
    margin-top: 14px;
  }
  .section-header {
    font-size: 1.05rem;
    padding: 6px 0;
    margin-top: 6px;
  }
  .skate-box {
    min-height: 65px; /* requested 65px */
    font-size: 1.15rem; /* slightly smaller to fit */
    border-width: 2px;
  }
  .instructions {
    padding: 14px; /* -30% */
    margin-bottom: 14px; /* -30% */
  }
  .instructions h3 {
    margin-bottom: 6px;
    font-size: 1.05rem;
  }
  .instructions p {
    font-size: 0.95rem;
    line-height: 1.45; /* tighter */
  }
}

/* Tablet Landscape Optimization */
@media (orientation: landscape) and (max-width: 1024px) {
  body {
    padding: 12px; /* slightly tighter in landscape */
  }
  
  .container {
    padding: 18px;
  }
  
  .header {
    margin-bottom: 16px;
  }
  
  .header h1 {
    font-size: 1.6rem;
  }
}

/* Prevent zooming on mobile */
@media (max-width: 768px) {
  input, select, textarea, button {
    font-size: 16px !important;
  }
}

/* Accessibility - Pattern overlays for color-blind users */
.skate-box.green::before,
.skate-box.orange::before,
.skate-box.red::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 9px;
  pointer-events: none;
}

.skate-box.orange::before {
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(255, 255, 255, 0.1) 5px,
    rgba(255, 255, 255, 0.1) 10px
  );
}

.skate-box.red::before {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgba(255, 255, 255, 0.15) 5px,
    rgba(255, 255, 255, 0.15) 10px
  );
}

/* Print Styles */
@media print {
  body {
    background: white;
  }
  
  .connection-status,
  .instructions {
    display: none;
  }
}

