/* BumpyBall Match Analyzer - Shared Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(145deg, #0d0d1a 0%, #1a1a2e 100%);
  color: #e0e0e0;
  min-height: 100vh;
  padding-top: 70px;
}

/* Header / Navigation */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(13, 13, 26, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  transition: all 0.3s ease;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
  display: flex;
  align-items: center;
  letter-spacing: 1.5px;
}

.logo .bumpy {
  color: #fff;
  background: linear-gradient(135deg, #00d4ff 0%, #0088ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo .analyzer {
  color: #555;
  font-weight: 400;
  margin-left: 10px;
  font-size: 14px;
  letter-spacing: 2px;
}

.nav {
  display: flex;
  gap: 5px;
  align-items: center;
}

.nav-link {
  color: #999;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.1);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  margin-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  height: 30px;
}

.nav-username {
  color: #00d4ff;
  font-size: 13px;
  font-weight: 600;
  background: rgba(0, 212, 255, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
}

.btn {
  background: linear-gradient(145deg, #333 0%, #222 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #888;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: linear-gradient(145deg, #444 0%, #333 100%);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(145deg, #00d4ff 0%, #00a0cc 100%);
  color: #000;
  border-color: #00d4ff;
  font-weight: 600;
}

.btn-primary:hover {
  background: linear-gradient(145deg, #00e5ff 0%, #00b0dd 100%);
  color: #000;
}

.btn-danger {
  background: linear-gradient(145deg, #ff4466 0%, #cc3355 100%);
  color: #fff;
  border-color: #ff4466;
}

.btn-danger:hover {
  background: linear-gradient(145deg, #ff5577 0%, #dd4466 100%);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-logout {
  background: rgba(255, 68, 102, 0.05);
  border: 1px solid rgba(255, 68, 102, 0.2);
  color: #ff4466;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(255, 68, 102, 0.15);
  border-color: #ff4466;
  color: #fff;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px;
}

/* Cards */
.card {
  background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 100%);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(0, 212, 255, 0.35);
  box-shadow: 0 8px 20px rgba(0, 212, 255, 0.08);
}

.card-header {
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.15), rgba(0, 212, 255, 0.05));
  padding: 14px 18px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  border-bottom: 2px solid rgba(0, 212, 255, 0.2);
}

.card-content {
  padding: 20px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.form-input,
.form-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2300d4ff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 10px;
  padding-right: 40px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #00d4ff;
  background: rgba(0, 0, 0, 0.5);
}

.form-input::placeholder {
  color: #555;
}

.form-select option {
  background: #000;
  color: #fff;
}

/* Grid layouts */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Match cards */
.match-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.match-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.2);
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.match-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  word-break: break-word;
}

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

.match-actions button {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: color 0.2s;
}

.match-actions button:hover {
  color: #00d4ff;
}

.match-actions button.delete:hover {
  color: #ff4466;
}

.match-score {
  text-align: center;
  margin: 15px 0;
}

.match-score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  font-size: 32px;
  font-weight: bold;
}

.match-score-display .blue {
  color: #00d4ff;
}

.match-score-display .divider {
  color: #666;
}

.match-score-display .red {
  color: #ff4466;
}

.match-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 15px 0;
  font-size: 12px;
  color: #666;
}

.match-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.match-date {
  text-align: center;
  font-size: 11px;
  color: #555;
  margin-bottom: 15px;
}

/* Session cards */
.session-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 15px;
  border-left: 3px solid #666;
}

.session-card.running {
  border-color: #27ae60;
}

.session-card.starting {
  border-color: #f39c12;
}

.session-card.stopping {
  border-color: #e74c3c;
}

.session-card.stopped {
  border-color: #666;
}

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

.session-server {
  font-weight: 600;
  color: #fff;
}

.session-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.session-status.running {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
}

.session-status.starting {
  background: rgba(243, 156, 18, 0.2);
  color: #f39c12;
}

.session-status.stopping {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.session-status.stopped {
  background: rgba(255, 255, 255, 0.1);
  color: #888;
}

.session-info {
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #888;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
}

/* Login page specific */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  font-size: 36px;
  font-weight: 600;
  margin-bottom: 10px;
}

.login-logo .bumpy {
  color: #00d4ff;
}

.login-logo .analyzer {
  color: #888;
  font-weight: 300;
}

.login-subtitle {
  color: #666;
  font-size: 14px;
}

.login-error {
  background: rgba(255, 68, 102, 0.1);
  border: 1px solid rgba(255, 68, 102, 0.3);
  color: #ff4466;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  text-align: center;
  display: none;
}

.login-error.show {
  display: block;
}

/* Server selector */
.server-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.server-players {
  font-size: 12px;
  color: #888;
}

.server-locked::after {
  content: ' 🔒';
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-radius: 50%;
  border-top-color: #00d4ff;
  animation: spin 1s linear infinite;
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: rgba(13, 13, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  width: 100%;
  max-width: 450px;
  padding: 0;
  transform: scale(0.95) translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-backdrop.show .modal {
  transform: scale(1) translateY(0);
}

.modal-title {
  padding: 20px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #fff;
  margin: 0;
}

/* Modal Content area - matches any div that is not title or actions */
.modal > :not(.modal-title):not(.modal-actions) {
  padding: 0 25px;
  margin-bottom: 15px;
}

/* Reset form-group margin inside modal to avoid double spacing */
.modal .form-group {
  margin-bottom: 0;
}

/* First content element needs top margin */
.modal-title + :not(.modal-actions) {
  margin-top: 25px;
}

.modal-actions {
  padding: 20px 25px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin: 0;
}

/* Modal specific text styles */
.modal-confirm-message {
  color: #888;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 5px;
}

/* Shared Icon Style */
.icon-svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
}

.toast {
  background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 100%);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  padding: 15px 20px;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-color: rgba(39, 174, 96, 0.5);
}

.toast.error {
  border-color: rgba(255, 68, 102, 0.5);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 15px 20px;
    flex-direction: column;
    gap: 15px;
  }

  .nav {
    width: 100%;
    justify-content: center;
  }

  .container {
    padding: 20px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Recording Timer */
.recording-timer {
  background: linear-gradient(145deg, rgba(255, 68, 102, 0.2) 0%, rgba(255, 68, 102, 0.1) 100%);
  border: 1px solid rgba(255, 68, 102, 0.3);
  border-radius: 6px;
  padding: 10px 15px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recording-timer .timer-label {
  color: #ff4466;
  font-size: 13px;
  font-weight: 500;
}

.recording-timer .timer-value {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.recording-timer .timer-value.timer-warning {
  color: #ff4466;
  animation: pulse 1s infinite;
}

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

/* Idle Timer (for connected but not recording sessions) */
.idle-timer {
  background: linear-gradient(145deg, rgba(136, 136, 136, 0.15) 0%, rgba(136, 136, 136, 0.05) 100%);
  border: 1px solid rgba(136, 136, 136, 0.2);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.idle-timer .timer-label {
  color: #888;
  font-size: 12px;
  font-weight: 400;
}

.idle-timer .timer-value {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 500;
  color: #aaa;
}

.idle-timer .timer-value.timer-warning {
  color: #ffaa00;
  animation: pulse 1s infinite;
}

/* Full width cards for grid layouts */
.full-width {
  grid-column: 1 / -1;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 13, 26, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 212, 255, 0.2);
  border-radius: 50%;
  border-top-color: #00d4ff;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.loading-text {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.loading-subtext {
  font-size: 13px;
  color: #666;
}

/* Error state */
.error-state {
  text-align: center;
  padding: 100px 20px;
}

.error-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.error-state h2 {
  font-size: 24px;
  color: #ff4466;
  margin-bottom: 10px;
}

.error-state p {
  color: #888;
  margin-bottom: 30px;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Chat log styling */
.chat-message {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.03);
  align-items: baseline;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.chat-message:hover {
  background: rgba(255, 255, 255, 0.08);
}

.chat-message.active {
  background: rgba(0, 212, 255, 0.1);
  border-left: 3px solid #00d4ff;
}

.chat-time {
  font-family: monospace;
  font-size: 11px;
  color: #666;
  min-width: 50px;
}

.chat-player {
  font-weight: 600;
  min-width: 80px;
}

.chat-player.blue {
  color: #00d4ff;
}

.chat-player.red {
  color: #ff4466;
}

.chat-text {
  color: #e0e0e0;
  word-break: break-word;
}

/* Chat sync states - controls opacity based on replay time */
.chat-message.chat-reached {
  opacity: 1;
}

.chat-message.chat-reached .chat-time,
.chat-message.chat-reached .chat-text {
  color: #e0e0e0;
}

.chat-message.chat-future {
  opacity: 0.4;
}

.chat-message.chat-future .chat-time,
.chat-message.chat-future .chat-text {
  color: #666;
}

/* Awards styling */
.award-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.award-title {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.award-player {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.award-player.blue {
  color: #00d4ff;
}

.award-player.red {
  color: #ff4466;
}

.award-value {
  font-size: 12px;
  color: #666;
}

/* Heatmap label */
.heatmap-label {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #888;
}