/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Color System */
  --color-background: #0a0a0b;
  --color-surface: #1a1a1c;
  --color-surface-elevated: #252529;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(255, 255, 255, 0.16);
  --color-border-focus: rgba(59, 130, 246, 0.4);
  
  /* Text Colors */
  --color-text-primary: #ffffff;
  --color-text-secondary: #a1a1aa;
  --color-text-tertiary: #71717a;
  --color-text-muted: #52525b;
  
  /* Brand Colors */
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-accent: #06b6d4;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  
  /* Effects */
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --gradient-surface: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  
  /* Typography */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-mono: 'JetBrains Mono', Consolas, Monaco, monospace;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
}

/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-primary);
  background: var(--color-background);
  color: var(--color-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== MAIN CONTAINER ===== */
.add-teams {
  min-height: 100vh;
  padding: var(--space-lg);
  position: relative;
  background: 
    radial-gradient(ellipse at top left, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(6, 182, 212, 0.03) 0%, transparent 50%);
}

/* Background Effects */
.add-teams::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
}

/* ===== NAVIGATION VECTORS ===== */
.vector-1 {
  position: fixed;
  top: var(--space-lg);
  width: 48px;
  height: 48px;
  z-index: 1000;
  transition: var(--transition-base);
  filter: brightness(0.8);
}

.vector-1:hover {
  transform: scale(1.1);
  filter: brightness(1.2);
}

.add-teams > a .vector-1 {
  left: var(--space-lg);
}

.tdesignrollback {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
}

/* ===== FORM HEADER ===== */
.form-header {
  max-width: 800px;
  margin: 0 auto var(--space-3xl);
  text-align: center;
  padding-top: var(--space-3xl);
}

.form-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: var(--space-md);
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.form-description {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.form-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-primary);
  backdrop-filter: blur(10px);
}

.stat-icon {
  font-size: 1.125rem;
}

/* ===== FORM CONTAINER ===== */
.fencer-form {
  max-width: 700px;
  margin: 0 auto;
  background: rgba(26, 26, 28, 0.6);
  backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}

.fencer-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-surface);
  opacity: 0.3;
  pointer-events: none;
}

.fencer-form > * {
  position: relative;
  z-index: 1;
}

/* ===== FORM SECTIONS ===== */
.form-section {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text-primary);
}

.section-icon {
  font-size: 1.5rem;
}

.section-description {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

/* ===== FORM INPUTS ===== */
label {
  display: block;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  margin-top: var(--space-md);
  font-size: 0.95rem;
}

label:first-of-type {
  margin-top: 0;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition-base);
  backdrop-filter: blur(10px);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  background-size: 16px;
  padding-right: var(--space-2xl);
  appearance: none;
}

select option {
  background: var(--color-surface);
  color: var(--color-text-primary);
  padding: var(--space-sm);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

/* ===== FIELD NOTES ===== */
.field-note {
  display: block;
  color: var(--color-text-tertiary);
  font-size: 0.8rem;
  margin-top: var(--space-xs);
  font-style: italic;
}

/* ===== CLASSIFICATION DISPLAY ===== */
.classification-display {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-sm) 0;
}

.classification-display strong {
  display: block;
  color: var(--color-primary);
  font-size: 1rem;
  margin-bottom: var(--space-xs);
}

.classification-note {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: normal;
}

#classification {
  font-family: var(--font-family-mono);
  font-weight: 700;
}

/* ===== FORM ACTIONS ===== */
.form-actions {
  text-align: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-2xl);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  font-family: inherit;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.submit-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 1.25rem;
  font-weight: bold;
}

.form-footer {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-top: var(--space-md);
  line-height: 1.5;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-section {
  animation: fadeInUp 0.6s ease-out forwards;
}

.form-section:nth-child(1) { animation-delay: 0.1s; }
.form-section:nth-child(2) { animation-delay: 0.2s; }
.form-section:nth-child(3) { animation-delay: 0.3s; }

.form-header {
  animation: fadeInUp 0.8s ease-out forwards;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 1024px) {
  .add-teams {
    padding: var(--space-md);
  }
  
  .fencer-form {
    padding: var(--space-xl);
  }
  
  .form-header {
    margin-bottom: var(--space-2xl);
    padding-top: var(--space-2xl);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .add-teams {
    padding: var(--space-sm);
  }
  
  .vector-1 {
    width: 40px;
    height: 40px;
    top: var(--space-md);
  }
  
  .add-teams > a .vector-1 {
    left: var(--space-md);
  }
  
  .tdesignrollback {
    top: var(--space-md);
    right: var(--space-md);
  }
  
  .form-header {
    padding-top: var(--space-xl);
    margin-bottom: var(--space-xl);
  }
  
  .form-title {
    font-size: clamp(2rem, 6vw, 2.5rem);
  }
  
  .form-description {
    font-size: 1rem;
  }
  
  .form-stats {
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }
  
  .stat-item {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
  
  .fencer-form {
    padding: var(--space-lg);
    border-radius: var(--radius-xl);
  }
  
  .form-section {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
  }
  
  .section-title {
    font-size: 1.125rem;
  }
  
  .section-icon {
    font-size: 1.25rem;
  }
  
  input[type="text"],
  input[type="number"],
  select,
  textarea {
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
  }
  
  select {
    background-position: right var(--space-sm) center;
    padding-right: var(--space-xl);
  }
  
  .submit-btn {
    width: 100%;
    max-width: none;
    padding: var(--space-md);
    font-size: 1rem;
  }
  
  .classification-display {
    padding: var(--space-sm) var(--space-md);
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .add-teams {
    padding: var(--space-xs);
  }
  
  .vector-1 {
    width: 36px;
    height: 36px;
    top: var(--space-sm);
  }
  
  .add-teams > a .vector-1 {
    left: var(--space-sm);
  }
  
  .tdesignrollback {
    top: var(--space-sm);
    right: var(--space-sm);
  }
  
  .fencer-form {
    padding: var(--space-md);
  }
  
  .form-header {
    padding-top: var(--space-lg);
  }
  
  .form-stats {
    gap: var(--space-sm);
  }
  
  .stat-item {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
  }
  
  .stat-icon {
    font-size: 1rem;
  }
  
  .section-title {
    font-size: 1rem;
    gap: var(--space-xs);
  }
  
  .section-icon {
    font-size: 1.125rem;
  }
  
  .section-description {
    font-size: 0.875rem;
  }
  
  label {
    font-size: 0.9rem;
  }
  
  .field-note {
    font-size: 0.75rem;
  }
  
  .classification-display strong {
    font-size: 0.95rem;
  }
  
  .classification-note {
    font-size: 0.75rem;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for accessibility */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.submit-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: rgba(255, 255, 255, 0.3);
    --color-border-hover: rgba(255, 255, 255, 0.5);
    --color-border-focus: rgba(59, 130, 246, 0.8);
  }
}

/* Dark mode support (already dark by default) */
@media (prefers-color-scheme: light) {
  /* Keep dark theme as it's part of the brand identity */
}

/* Print styles */
@media print {
  .vector-1,
  .tdesignrollback {
    display: none;
  }
  
  .add-teams {
    background: white;
    color: black;
  }
  
  .fencer-form {
    background: white;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}