/* =========================================================
   RACEWAY DASHBOARD (style.css replacement)
   ========================================================= */

/* Override global app-shell for full width */
.app-shell {
  padding: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  display: flex;
  flex-direction: column;
}

/* Base Dashboard Container */
.pro-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - var(--header-h, 100px) - 40px);
  min-height: 500px;
  padding: 16px min(2vw, 24px) !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* --- HEADER BAR --- */
.pro-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--brand-border, #e2e8f0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.pro-title h1 {
  font-size: 1.4rem;
  margin: 0 0 4px 0;
  color: var(--brand-text, #1e293b);
}
.pro-title p {
  font-size: 0.85rem;
  margin: 0;
  color: var(--brand-subtle-text, #64748b);
}
.pro-settings {
  display: flex;
  gap: 16px;
}
.pro-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pro-control label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--brand-subtle-text, #64748b);
  letter-spacing: 0.05em;
}
.pro-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
}
.pro-select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* --- 3-PANE WORKSPACE --- */
.pro-workspace {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  gap: 16px;
  flex: 1; 
  min-height: 0; 
}

.pro-panel {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--brand-border, #e2e8f0);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

/* Common Header within Panes */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.panel-header label, .panel-header h2 {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #475569;
  margin: 0;
  letter-spacing: 0.02em;
}
.icon-btn {
  background: none;
  border: none;
  color: #3498db;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.icon-btn:hover {
  background: #e0f2fe;
}

/* Left Pane: Inputs */
#namesInput {
  flex: 1;
  resize: none;
  border: none;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  background: transparent;
  color: #334155;
}
#namesInput:focus { outline: none; background: #ffffff; }

.panel-footer {
  padding: 12px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.pro-primary-btn {
  width: 100%;
  padding: 14px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}
.pro-primary-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 2px rgba(52, 152, 219, 0.3);
}
.pro-primary-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

/* Right Pane: Results */
.results-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
#resultsOrderList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
#resultsOrderList li.finished-entry {
  background: #ffffff;
  border-left: 4px solid #3498db;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  animation: slideIn 0.2s ease-out forwards;
}

/* --- CENTER PANE: TRACK VISUALS --- */
.track-panel {
  overflow-y: auto;
  position: relative;
}
#track-container {
  position: relative;
  width: 100%;
  min-height: 100%; 
}

/* Track Themes */
.track-style-classic { background: linear-gradient(180deg, #e0f7fa 0%, #b2ebf2 100%); }
.track-style-night { background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%); }
.track-style-night::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18), transparent 55%),
              radial-gradient(circle at 80% 30%, rgba(255,255,255,0.1), transparent 60%);
}
.track-style-sunset { background: linear-gradient(180deg, #ff9a9e 0%, #fad0c4 50%, #fad0c4 100%); }
.track-style-forest { background: linear-gradient(180deg, #a8e6cf 0%, #dcedc1 40%, #ffd3b6 100%); }

/* Start/Finish Lines */
#start-line, #finish-line-visual {
  position: absolute; top: 0; bottom: 0; width: 8px;
  background: repeating-linear-gradient(to bottom, #fff, #fff 10px, #000 10px, #000 20px);
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  z-index: 3;
}
#start-line { left: 5%; border-right: 2px solid #ccc; }
#finish-line-visual { right: 5%; border-left: 2px solid #ccc; }

/* Racers */
.racer {
  position: absolute;
  width: 140px; height: 34px;
  display: flex; align-items: center;
  transition: left 0.1s linear;
  z-index: 5;
  pointer-events: none;
}
.vehicle-body {
  font-size: 32px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scaleX(-1); /* Flips emojis facing left to face right */
}
.racer-name {
  font-size: 0.75rem; 
  margin-left: 10px; 
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 800;
  white-space: nowrap;
}

/* Vehicle Orientations & Animations */
.racer[data-vehicle="skier"] .vehicle-body { transform: scaleX(1); }
.racer[data-vehicle="rocket"] .vehicle-body { transform: rotate(45deg); }

.racer[data-vehicle="turtle"] .vehicle-body { animation: t-crawl 0.6s infinite ease-in-out; }
@keyframes t-crawl { 50% { transform: scaleX(-1.1) translateY(-2px); } }

.racer[data-vehicle="car"] .vehicle-body { animation: c-speed 0.1s infinite alternate; }
@keyframes c-speed { to { transform: scaleX(-1) translateX(-2px); } }

.racer[data-vehicle="ghost"] .vehicle-body { animation: g-float 2s infinite ease-in-out; opacity: 0.8; }
@keyframes g-float { 50% { transform: scaleX(-1) translateY(-8px) scale(1.05); opacity: 0.9; } }

.racer[data-vehicle="skier"] .vehicle-body { animation: s-vibe 0.15s infinite alternate ease-in-out; }
@keyframes s-vibe { to { transform: scaleX(1) translateY(-1px); } }

.racer[data-vehicle="rocket"] .vehicle-body { animation: r-vibe 0.1s infinite alternate; }
@keyframes r-vibe { to { transform: rotate(45deg) translateY(-1px); } }

/* Victory Animations */
.racer.finished { z-index: 10; }
.racer.finished .vehicle-body { animation: v-win 0.5s ease-out forwards; }
@keyframes v-win {
  50% { transform: scaleX(-1) scale(1.5) rotate(15deg); }
  100% { transform: scaleX(-1) scale(1.2) rotate(0); }
}
.racer.finished[data-vehicle="rocket"] .vehicle-body { animation: r-win 0.5s ease-out forwards; }
@keyframes r-win {
  50% { transform: rotate(45deg) scale(1.5) rotate(15deg); }
  100% { transform: rotate(45deg) scale(1.2) rotate(0); }
}
.racer.finished[data-vehicle="skier"] .vehicle-body { animation: s-win 0.5s ease-out forwards; }
@keyframes s-win {
  50% { transform: scaleX(1) scale(1.5) rotate(15deg); }
  100% { transform: scaleX(1) scale(1.2) rotate(0); }
}

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

/* --- SEO SECTION --- */
.seo-content-area { margin-top: 3rem; padding: 0 20px; max-width: 1000px; margin-left: auto; margin-right: auto; }
.seo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; text-align: left; margin-top: 1rem; }

/* --- RESPONSIVE TABLET & MOBILE --- */
@media (max-width: 1024px) {
  .pro-workspace { grid-template-columns: 200px 1fr 200px; }
}

@media (max-width: 850px) {
  .pro-dashboard { height: auto; min-height: 800px; padding: 12px; }
  .pro-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .pro-settings { width: 100%; justify-content: space-between; }
  .pro-workspace { grid-template-columns: 1fr; grid-template-rows: auto 400px auto; }
  #namesInput { min-height: 120px; }
  .seo-grid { grid-template-columns: 1fr; }
}