@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --font-heading: "Sora", sans-serif;
  --font-body: "Manrope", sans-serif;
  --background: hsl(0 0% 7%);
  --foreground: hsl(0 0% 95%);
  --card: hsl(0 0% 11%);
  --card-foreground: hsl(0 0% 95%);
  --secondary: hsl(0 0% 17%);
  --muted-foreground: hsl(0 0% 55%);
  --border: hsl(0 0% 20%);
  --primary: hsl(15 78% 57%);
  --primary-foreground: hsl(0 0% 100%);
  --destructive: hsl(0 84% 60%);
  --success: hsl(142 71% 45%);
  --warning: hsl(38 92% 50%);
  --radius: 0.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  margin: 0;
}

a {
  color: var(--primary);
}

button,
input,
select,
textarea {
  font: inherit;
}

.gradient-primary {
  background: linear-gradient(135deg, hsl(15, 78%, 57%), hsl(25, 90%, 65%));
}

.text-gradient {
  background: linear-gradient(135deg, hsl(15, 78%, 57%), hsl(25, 90%, 65%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.glass-card {
  background: hsl(0 0% 11% / 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid hsl(0 0% 20% / 0.5);
  border-radius: var(--radius);
}

.glow-primary {
  box-shadow: 0 0 30px -5px hsl(15 78% 57% / 0.3);
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

/* Login */
.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .login-layout {
    grid-template-columns: 1fr 1fr;
  }
}

.login-hero {
  display: none;
  position: relative;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
}

@media (min-width: 1024px) {
  .login-hero {
    display: flex;
  }
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--background), var(--secondary), var(--background));
}

.login-hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.1;
  background: linear-gradient(135deg, hsl(15, 78%, 57%), hsl(25, 90%, 65%));
}

.login-hero-glow.a {
  top: 25%;
  left: 25%;
  width: 24rem;
  height: 24rem;
}

.login-hero-glow.b {
  bottom: 25%;
  right: 25%;
  width: 16rem;
  height: 16rem;
  opacity: 0.05;
}

.login-hero-content {
  position: relative;
  z-index: 1;
  max-width: 28rem;
  padding: 3rem;
  text-align: center;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.login-form-wrap {
  width: 100%;
  max-width: 28rem;
}

.logo {
  height: 2rem;
  width: auto;
  object-fit: contain;
}

.logo-lg {
  height: 2.5rem;
  margin-bottom: 2rem;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.input,
.select {
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s;
}

.input:focus,
.select:focus {
  border-color: var(--primary);
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-left: 2.5rem;
}

.input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  opacity: 0.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 3rem;
  padding: 0 1.25rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  color: var(--primary-foreground);
}

.btn-primary:not(:disabled):hover {
  opacity: 0.92;
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
}

.btn-ghost:hover {
  color: var(--foreground);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
  height: 2.5rem;
}

.btn-outline:hover {
  border-color: hsl(15 78% 57% / 0.4);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error {
  border: 1px solid hsl(0 84% 60% / 0.4);
  background: hsl(0 84% 60% / 0.1);
  color: var(--destructive);
}

.alert-info {
  border: 1px solid hsl(15 78% 57% / 0.3);
  background: hsl(15 78% 57% / 0.08);
  color: var(--foreground);
}

.subtitle {
  color: var(--muted-foreground);
  margin: 0.5rem 0 2rem;
}

/* Main layout */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
}

.page-content {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.section {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
  gap: 0.5rem;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
}

.color-swatch:hover {
  transform: scale(1.05);
}

.color-swatch.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px hsl(15 78% 57% / 0.35);
}

.player-card {
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.player-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.player-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: hsl(15 78% 57% / 0.5);
  background: hsl(15 78% 57% / 0.05);
}

.dropzone.has-file {
  border-style: solid;
  border-color: hsl(142 71% 45% / 0.4);
}

.dropzone-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.dropzone-hint {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.progress-bar {
  height: 0.5rem;
  background: var(--secondary);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 1rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, hsl(15, 78%, 57%), hsl(25, 90%, 65%));
  transition: width 0.2s;
  width: 0%;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.checkbox-row input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.toggle {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  background: var(--secondary);
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.toggle.on {
  background: hsl(15 78% 57% / 0.35);
  border-color: hsl(15 78% 57% / 0.5);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--foreground);
  transition: transform 0.15s;
}

.toggle.on .toggle-knob {
  transform: translateX(1.25rem);
  background: var(--primary);
}

/* Status line */
.status-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.status-line {
  text-align: center;
  max-width: 36rem;
  padding: 2rem;
}

.status-line p {
  font-size: 1.125rem;
  line-height: 1.6;
  margin: 0 0 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid;
}

.status-pending {
  color: var(--warning);
  border-color: hsl(38 92% 50% / 0.3);
  background: hsl(38 92% 50% / 0.12);
}

.status-processing {
  color: hsl(210 90% 65%);
  border-color: hsl(210 90% 65% / 0.3);
  background: hsl(210 90% 65% / 0.12);
}

.status-completed {
  color: var(--success);
  border-color: hsl(142 71% 45% / 0.3);
  background: hsl(142 71% 45% / 0.12);
}

.status-error {
  color: var(--destructive);
  border-color: hsl(0 84% 60% / 0.3);
  background: hsl(0 84% 60% / 0.12);
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Analysis detail */
.analysis-meta {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
}

.player-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.player-tab {
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
}

.player-tab.active {
  border-color: hsl(15 78% 57% / 0.5);
  background: hsl(15 78% 57% / 0.12);
  color: var(--foreground);
}

.stats-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}

.stat-item {
  padding: 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--secondary);
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
  text-transform: capitalize;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
}

.empty-stats {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  padding: 1rem 0;
}
