/* ========================================
   CHAS ALL STATS - Login Styles
   Responsive CSS para dispositivos desde 320px
   ======================================== */

/* Variables CSS */
:root {
  /* Colores principales */
  --primary-color: #F2643A;
  --primary-hover: #e55530;
  --primary-light: rgba(242, 100, 58, 0.1);
  --primary-dark: #d44821;
  
  /* Colores neutros */
  --white: #FFFFFF;
  --light-gray: #E8E8E8;
  --dark-gray: #1A1A1A;
  --text-primary: #1A1A1A;
  --text-secondary: #6C757D;
  --text-light: #9CA3AF;
  
  /* Colores de estado */
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  
  /* Espaciado */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Bordes */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Transiciones */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.3s ease-out;
  --transition-slow: 0.6s ease-out;
  
  /* Tipografía */
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
}

/* Reset y base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Contenedor principal */
.login-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 10;
}

/* Panel izquierdo - Branding */
.login-brand {
  flex: 1;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl);
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('../recursos/img1.png');
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0.3;
}

.brand-content {
  text-align: center;
  color: var(--white);
  position: relative;
  z-index: 2;
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-container {
  margin-bottom: var(--spacing-xl);
}

.brand-logo {
  width: 200px;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  border-radius: 10px;
}

.brand-title {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  margin-bottom: var(--spacing-md);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: var(--font-size-lg);
  opacity: 0.9;
  line-height: 1.6;
  margin-bottom: var(--spacing-2xl);
}

/* Elementos decorativos */
.decorative-elements {
  position: relative;
  opacity: 0.6;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-lg);
  z-index: 2;
}

.basketball-element {
  width: 60px;
  height: 60px;
  background: var(--white);
  border-radius: 50%;
  position: relative;
  transition: transform var(--transition-slow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.basketball-element::before,
.basketball-element::after {
  content: '';
  position: absolute;
  background: var(--primary-color);
  border-radius: 2px;
}

.basketball-element::before {
  width: 2px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.basketball-element::after {
  width: 100%;
  height: 2px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.stats-element {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
}

.stat-bar {
  width: 8px;
  background: var(--white);
  border-radius: 4px;
  transition: height var(--transition-normal);
}

.stat-bar:nth-child(1) { height: 20px; }
.stat-bar:nth-child(2) { height: 35px; }
.stat-bar:nth-child(3) { height: 25px; }

/* Panel derecho - Formulario */
.login-form-panel {
  flex: 1;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl);
  position: relative;
}

.form-container {
  width: 100%;
  max-width: 420px;
}

/* Logo móvil (oculto por defecto) */
.mobile-logo {
  display: none;
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.mobile-brand-logo {
  width: 200px;
  height: auto;
  border-radius: 10px;
}

/* Encabezado del formulario */
.form-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.form-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.form-subtitle {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

/* Formulario */
.login-form {
  width: 100%;
}

.form-group {
  margin-bottom: var(--spacing-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-slow);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.label-required {
  color: var(--error);
  margin-left: 2px;
}

/* Contenedor de input */
.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 3rem;
  border: 2px solid var(--light-gray);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  font-family: inherit;
  background: var(--white);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input.error {
  border-color: var(--error);
}

.form-input.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input::placeholder {
  color: var(--text-light);
}

/* Iconos de input */
.input-icon {
  position: absolute;
  left: var(--spacing-md);
  color: var(--text-light);
  pointer-events: none;
  z-index: 2;
}

.form-input:focus + .input-icon {
  color: var(--primary-color);
}

/* Toggle de contraseña */
.password-toggle {
  position: absolute;
  right: var(--spacing-md);
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  z-index: 2;
}

.password-toggle:hover {
  color: var(--primary-color);
}

.password-toggle:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Errores de formulario */
.form-error {
  margin-top: var(--spacing-xs);
  font-size: var(--font-size-sm);
  color: var(--error);
  opacity: 0;
  transform: translateY(-5px);
  transition: all var(--transition-fast);
}

.form-error.show {
  opacity: 1;
  transform: translateY(0);
}

/* Opciones del formulario */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

/* Checkbox personalizado */
.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.checkbox-container input[type="checkbox"] {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--light-gray);
  border-radius: var(--radius-sm);
  margin-right: var(--spacing-sm);
  position: relative;
  transition: all var(--transition-fast);
}

.checkbox-container:hover .checkmark {
  border-color: var(--primary-color);
}

.checkbox-container input:checked + .checkmark {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.checkbox-container input:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-container input:focus + .checkmark {
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Enlace de contraseña olvidada */
.forgot-password {
  color: var(--primary-color);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.forgot-password:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Botón de envío */
.submit-button {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.submit-button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.submit-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

.submit-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.submit-button:focus {
  outline: none;
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--primary-light);
}

/* Contenido del botón */
.button-text {
  transition: opacity var(--transition-fast);
}

.button-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--white);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mensajes del formulario */
.form-message {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

.form-message.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-message.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Elementos de fondo */
.background-elements {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.bg-circle {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  opacity: 0.05;
  animation: float 6s ease-in-out infinite;
}

.bg-circle-1 {
  width: 200px;
  height: 200px;
  top: 10%;
  right: 10%;
  animation-delay: 0s;
}

.bg-circle-2 {
  width: 300px;
  height: 300px;
  bottom: 20%;
  left: 5%;
  animation-delay: 2s;
}

.bg-circle-3 {
  width: 150px;
  height: 150px;
  top: 60%;
  right: 30%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* Utilidades */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.volver{
    margin: 2% 25%;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.volver a{
    text-decoration: none;
    font-size: 30px;
    background-color: #e55530;
    padding: 0 10px;
    border-radius: 10px;
}

.volver a:hover{
    background-color: #d44821;
    transform: translateY(-1px);
}

.volver a i{
    color: white;
}

.error-message {
  background:
  rgba(254, 226, 226, 0.95);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
  box-shadow:
          0 4px 20px rgba(220, 38, 38, 0.15),
          0 0 0 1px rgba(220, 38, 38, 0.1);
}


.error-message .message-content {
  color: #b91c1c;
}

.error-message i {
  color: #ef4444;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.3));
  animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   MENSAJE DE ÉXITO
   ======================================== */

.success-message {
  background: rgba(187, 247, 208, 0.9) 50%;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  border-color: rgba(16, 185, 129, 0.3);
  color: #059669;
  box-shadow:
          0 4px 20px rgba(5, 150, 105, 0.15),
          0 0 0 1px rgba(5, 150, 105, 0.1);
}

.success-message .message-content {
  color: #047857;
}

.success-message i {
  color: #10b981;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3));
  animation: checkmark 0.6s ease-out 0.2s both;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
  .login-container {
    flex-direction: column;
  }
  
  .login-brand {
    flex: none;
    min-height: 200px;
    padding: var(--spacing-xl);
  }
  
  .brand-title {
    font-size: var(--font-size-2xl);
  }
  
  .brand-subtitle {
    font-size: var(--font-size-base);
  }
  
  .decorative-elements {
    position: static;
    transform: none;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
  }
  
  .basketball-element {
    margin-bottom: 0;
  }
}

/* Móviles grandes */
@media (max-width: 768px) {
  .login-brand {
    display: none;
  }
  
  .mobile-logo {
    display: block;
  }
  
  .login-form-panel {
    padding: var(--spacing-xl);
  }
  
  .form-container {
    max-width: 100%;
  }
  
  .form-title {
    font-size: var(--font-size-xl);
  }
  
  .form-options {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }
  
  .checkbox-container {
    justify-content: center;
  }
  
  .forgot-password {
    text-align: center;
  }
}

/* Móviles medianos */
@media (max-width: 480px) {
  :root {
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
  }
  
  .login-form-panel {
    padding: var(--spacing-lg);
  }
  
  .form-header {
    margin-bottom: var(--spacing-xl);
  }
  
  .form-title {
    font-size: var(--font-size-lg);
  }
  
  .form-subtitle {
    font-size: var(--font-size-sm);
  }
  
  .form-input {
    padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) 2.5rem;
    font-size: var(--font-size-sm);
  }
  
  .input-icon {
    left: var(--spacing-sm);
  }
  
  .password-toggle {
    right: var(--spacing-sm);
  }
  
  .submit-button {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
  }
  
  .bg-circle-1 {
    width: 150px;
    height: 150px;
  }
  
  .bg-circle-2 {
    width: 200px;
    height: 200px;
  }
  
  .bg-circle-3 {
    width: 100px;
    height: 100px;
  }
}

/* Móviles pequeños (320px) */
@media (max-width: 360px) {
  .login-form-panel {
    padding: var(--spacing-md);
  }
  
  .mobile-brand-logo {
    width: 120px;
  }
  
  .form-group {
    margin-bottom: var(--spacing-md);
  }
  
  .form-input {
    padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) 2.25rem;
  }
  
  .checkbox-text {
    font-size: var(--font-size-xs);
  }
  
  .forgot-password {
    font-size: var(--font-size-xs);
  }
  
  .form-message {
    font-size: var(--font-size-xs);
    padding: var(--spacing-sm);
  }
}

/* Pantallas ultra pequeñas (320px y menos) */
@media (max-width: 320px) {
  body.ultra-small-screen {
    font-size: 14px;
  }
  
  .login-form-panel {
    padding: var(--spacing-sm);
  }
  
  .form-container {
    padding: 0;
  }
  
  .mobile-brand-logo {
    width: 100px;
  }
  
  .form-title {
    font-size: var(--font-size-base);
  }
  
  .form-subtitle {
    font-size: var(--font-size-xs);
  }
  
  .form-input {
    padding: 10px 10px 10px 32px;
    font-size: var(--font-size-xs);
  }
  
  .input-icon {
    left: 10px;
  }
  
  .input-icon svg {
    width: 16px;
    height: 16px;
  }
  
  .password-toggle {
    right: 10px;
  }
  
  .password-toggle svg {
    width: 16px;
    height: 16px;
  }
  
  .checkmark {
    width: 16px;
    height: 16px;
  }
  
  .submit-button {
    padding: 10px var(--spacing-md);
    font-size: var(--font-size-xs);
  }
  
  .bg-circle {
    display: none;
  }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
  body.dark-mode {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: var(--white);
  }
  
  .dark-mode .login-form-panel {
    background: #030303;
  }
  
  .dark-mode .form-input {
    background: #374151;
    border-color: #4b5563;
    color: var(--white);
  }
  
  .dark-mode .form-input::placeholder {
    color: #9ca3af;
  }
  
  .dark-mode .form-input:focus {
    border-color: var(--primary-color);
    background: #374151;
  }
  
  .dark-mode .form-title {
    color: var(--white);
  }
  
  .dark-mode .form-label {
    color: var(--white);
  }
  
  .dark-mode .checkbox-text {
    color: #d1d5db;
  }
  
  .dark-mode .checkmark {
    border-color: #6b7280;
    background: #374151;
  }
  
  .dark-mode .form-message.success {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
  }
  
  .dark-mode .form-message.error {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
  }
}

/* Animaciones de carga */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group.animate {
  animation: fadeInUp 0.6s ease-out forwards;
}

/* Estados de hover mejorados para dispositivos táctiles */
@media (hover: hover) and (pointer: fine) {
  .form-input:hover {
    border-color: var(--primary-color);
  }
  
  .submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
  }
  
  .forgot-password:hover {
    text-decoration: underline;
  }
}

/* Mejoras para accesibilidad */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .bg-circle {
    animation: none;
  }
  
  .form-group {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Focus visible para navegación por teclado */
@supports selector(:focus-visible) {
  .form-input:focus {
    outline: none;
  }
  
  .form-input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
  
  .submit-button:focus {
    outline: none;
  }
  
  .submit-button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
}

/* Print styles */
@media print {
  .background-elements,
  .decorative-elements {
    display: none;
  }
  
  .login-container {
    flex-direction: column;
    min-height: auto;
  }
  
  .login-brand {
    display: none;
  }
  
  .mobile-logo {
    display: block;
  }
}