:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2332;
  --accent-primary: #3b5bdb;
  --accent-secondary: #5c7cfa;
  --accent-glow: #2a44a6;
  --error-color: #ef4444;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --glass-bg: rgba(17, 24, 39, 0.85);
  --glass-border: rgba(59, 91, 219, 0.3);
  --shadow-glow: 0 0 30px rgba(59, 91, 219, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, #0f1623 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: repeating-conic-gradient(
    rgba(59, 91, 219, 0.12) 0deg 90deg,
    rgba(17, 24, 39, 0.3) 90deg 180deg,
    rgba(59, 91, 219, 0.12) 180deg 270deg,
    rgba(17, 24, 39, 0.3) 270deg 360deg
  );
  background-size: 100px 100px;
  animation: slidePattern 80s linear infinite;
  z-index: 0;
  opacity: 0.6;
}

@keyframes slidePattern {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  100% {
    transform: translate(100px, 100px) rotate(5deg);
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: all 0.4s ease;
  padding: 1rem;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-content {
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 450px;
  text-align: center;
  position: relative;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.6),
    var(--shadow-glow);
  transform: translateY(0) scale(1);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.hidden .modal-content {
  transform: translateY(30px) scale(0.95);
}

.modal-close-x {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s;
}

.modal-close-x:hover {
  color: var(--error-color);
}

.modal-title {
  font-family: 'Orbitron';
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.chess-pieces {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.chess-piece {
  position: absolute;
  font-size: 3rem;
  opacity: 0.08;
  animation: floatPiece 20s ease-in-out infinite;
  color: var(--accent-secondary);
  text-shadow: 0 0 20px rgba(59, 91, 219, 0.5);
}

@keyframes floatPiece {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  25% {
    transform: translate(30px, -30px) rotate(5deg);
  }

  50% {
    transform: translate(-20px, -50px) rotate(-5deg);
  }

  75% {
    transform: translate(20px, -20px) rotate(3deg);
  }
}

.piece-1 {
  top: 10%;
  left: 10%;
  animation-delay: 0s;
  font-size: 4rem;
}

.piece-2 {
  top: 20%;
  right: 15%;
  animation-delay: 3s;
  font-size: 3.5rem;
}

.piece-3 {
  bottom: 15%;
  left: 8%;
  animation-delay: 6s;
  font-size: 3rem;
}

.piece-4 {
  bottom: 25%;
  right: 10%;
  animation-delay: 9s;
  font-size: 3.8rem;
}

.piece-5 {
  top: 50%;
  left: 5%;
  animation-delay: 12s;
  font-size: 2.5rem;
}

.piece-6 {
  top: 60%;
  right: 8%;
  animation-delay: 15s;
  font-size: 2.8rem;
}

.ambient-light {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 1;
  opacity: 0.4;
  animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }
}

.light-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 91, 219, 0.4) 0%, transparent 70%);
  top: -100px;
  left: -100px;
}

.light-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(92, 124, 250, 0.3) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
  animation-delay: 4s;
}

.light-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(42, 68, 166, 0.35) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 2s;
}

.auth-container {
  width: 100%;
  max-width: 380px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 2px solid var(--glass-border);
  border-radius: 24px;
  padding: 1.8rem 1.5rem;
  box-shadow:
    var(--shadow-glow),
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(59, 91, 219, 0.2);
  position: relative;
  z-index: 10;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.auth-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: repeating-conic-gradient(
    rgba(59, 91, 219, 0.03) 0deg 90deg,
    transparent 90deg 180deg,
    rgba(59, 91, 219, 0.03) 180deg 270deg,
    transparent 270deg 360deg
  );
  background-size: 40px 40px;
  z-index: -1;
  opacity: 0.4;
}

.auth-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-secondary) 50%, transparent 100%);
  opacity: 0.6;
  z-index: 1;
}

.logo-section {
  text-align: center;
  margin-bottom: 1.2rem;
}

.chess-icon-wrapper {
  position: relative;
  width: 65px;
  height: 65px;
  margin: 0 auto 0.4rem;
}

.mini-board {
  position: absolute;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  transform: rotate(45deg);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0.3;
}

.mini-square {
  background: rgba(59, 91, 219, 0.2);
}

.mini-square:nth-child(odd) {
  background: rgba(17, 24, 39, 0.4);
}

.chess-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow:
    0 5px 15px rgba(59, 91, 219, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: float 3s ease-in-out infinite;
  z-index: 2;
}

.logo-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #5c7cfa, #3b5bdb, #2a44a6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
  margin-bottom: 0.1rem;
  text-transform: uppercase;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.input-group {
  margin-bottom: 0.8rem;
  position: relative;
  text-align: left;
}

.input-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-label::before {
  content: '▪';
  color: var(--accent-primary);
  margin-right: 0.4rem;
  font-size: 0.5rem;
}

.input-fide {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(59, 91, 219, 0.3);
  background: rgba(17, 24, 39, 0.6) !important;
  color: var(--text-primary) !important;
  font-size: 1rem;
  font-weight: 400;
  outline: none;
  transition: all 0.3s;
  appearance: none;
  -webkit-appearance: none;
}

.input-fide::placeholder {
  color: var(--text-secondary) !important;
  opacity: 0.5;
  font-weight: 400;
}

.input-fide:focus {
  border-color: var(--accent-primary);
  background: rgba(17, 24, 39, 0.9) !important;
  box-shadow:
    0 0 0 2px rgba(59, 91, 219, 0.1),
    0 0 10px rgba(59, 91, 219, 0.2);
}

.btn-submit {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-glow));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  box-shadow:
    0 5px 15px rgba(59, 91, 219, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  margin-top: 0.5rem;
}

.btn-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.btn-submit:hover::before {
  left: 100%;
}

.btn-submit:active {
  transform: scale(0.98);
}

.corner-indicators {
  position: absolute;
  width: 15px;
  height: 15px;
  background: linear-gradient(135deg, var(--accent-primary), transparent);
}

.corner-tl {
  top: 0;
  left: 0;
  border-top-left-radius: 24px;
}

.corner-tr {
  top: 0;
  right: 0;
  border-top-right-radius: 24px;
  transform: rotate(90deg);
}

.corner-bl {
  bottom: 0;
  left: 0;
  border-bottom-left-radius: 24px;
  transform: rotate(-90deg);
}

.corner-br {
  bottom: 0;
  right: 0;
  border-bottom-right-radius: 24px;
  transform: rotate(180deg);
}

.toggle-link {
  text-align: center;
  margin-top: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: color 0.3s ease;
}

.toggle-link span {
  color: var(--accent-secondary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.toggle-link:hover {
  color: var(--text-primary);
}

.error-msg {
  color: #fca5a5;
  text-align: center;
  font-weight: 600;
  margin-bottom: 0.8rem;
  background: rgba(239, 68, 68, 0.15);
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.85rem;
  animation: shake 0.5s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(59, 91, 219, 0.3) 50%, transparent 100%);
  margin: 1.2rem 0 1rem 0;
  position: relative;
}

.divider::before {
  content: '♟';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-secondary);
  color: var(--accent-primary);
  font-size: 0.9rem;
  padding: 0 0.5rem;
}

.form-transition {
  animation: formFade 0.3s ease-in-out;
}

@keyframes formFade {
  0% {
    opacity: 0;
    transform: scale(0.97);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.portal-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(59, 91, 219, 0.2);
  text-align: center;
}

.portal-title {
  font-family: 'Orbitron';
  font-size: 1.1rem;
  color: var(--accent-secondary);
  margin-bottom: 1rem;
  letter-spacing: 1px;
  font-weight: 700;
}

.portal-form {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.portal-input {
  flex: 1;
  min-width: 0;
  height: 45px;
  padding: 0 1rem;
  border-radius: 10px;
  border: 1px solid rgba(59, 91, 219, 0.4);
  background: rgba(10, 14, 26, 0.6);
  color: white;
  text-align: center;
  text-transform: uppercase;
  font-family: 'Orbitron';
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 2px;
  outline: none;
  transition: 0.3s;
}

.portal-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(59, 91, 219, 0.3);
}

.portal-btn {
  flex-shrink: 0;
  height: 45px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-glow));
  color: white;
  border: none;
  padding: 0 1.5rem;
  border-radius: 10px;
  font-family: 'Orbitron';
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: 0 4px 10px rgba(59, 91, 219, 0.3);
}

.portal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(59, 91, 219, 0.4);
}

.portal-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.8rem;
  font-weight: 500;
}

.fab-inscripcion {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5c7cfa, #3b5bdb);
  color: white;
  font-size: 30px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(59, 91, 219, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s;
  z-index: 100;
}

.fab-inscripcion:hover {
  transform: scale(1.05) rotate(10deg);
}

.fab-inscripcion:active {
  transform: scale(0.95);
}

#form-registro-wrapper {
  display: none;
}
