/* ============================================
   VARIABLES Y RESET
   ============================================ */

:root {
  /* Colores principales basados en el logo */
  --primary: #ff8c42;
  --primary-dark: #ff6b1a;
  --primary-light: #ffad70;
  --secondary: #ff5470;
  --accent: #e91e63;
  
  /* Colores de estado */
  --success: #10b981;
  --success-light: #34d399;
  --error: #ef4444;
  --error-light: #f87171;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  /* Escala de grises */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Transiciones */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Bordes */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ============================================
   PANTALLAS
   ============================================ */

.screen {
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1;
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}
/* ============================================
   LOGIN SCREEN - DISEÑO ESPECTACULAR
   ============================================ */

#loginScreen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: hidden;
}

/* Fondo estático y profesional */
.login-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 0;
}

.login-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.15);
}

/* Patrón sutil de puntos (ligero y rápido) */
.animated-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.3;
}

/* Contenedor del login */
.login-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
}

.login-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 3rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.logo-icon {
  width: 40px;
  height: 40px;
  color: white;
}

.login-header h1 {
  font-size: 1.875rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.login-header p {
  color: var(--gray-600);
  font-size: 0.9375rem;
  font-weight: 500;
}

/* Formulario de login */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.label-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  stroke-width: 2;
}

.form-group input,
.password-input-wrapper input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: var(--transition);
  background: var(--gray-50);
}

.form-group input:focus,
.password-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 3rem;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* El icono debe cambiar de color cuando el input tiene foco */
.input-wrapper:focus-within .input-icon {
  color: var(--primary);
}

.toggle-password {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  border-radius: var(--radius-sm);
}

.toggle-password:hover {
  background: var(--gray-100);
}

.eye-icon {
  width: 20px;
  height: 20px;
  color: var(--gray-400);
  stroke-width: 2;
}

.error-message {
  background: #fee;
  border: 2px solid #f87171;
  color: #dc2626;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  display: none; /* Oculto por defecto */
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Cuando el error está visible, debe ser flex para que align-items funcione */
.error-message[style*="display: flex"],
.error-message[style*="display:flex"] {
  display: flex !important;
  animation: fadeInShake 0.5s ease-out;
}

.error-message::before {
  content: '⚠️';
  font-size: 1.25rem;
}

/* Animación para el mensaje de error */
@keyframes fadeInShake {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  50% {
    transform: translateX(-5px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Animación shake para errores */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.btn-login {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: var(--transition);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
}

.btn-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-login:hover::before {
  left: 100%;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

.login-footer {
  margin-top: 2rem;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ============================================
   MAIN SCREEN - DASHBOARD
   ============================================ */

#mainScreen {
  background: var(--gray-50);
}

/* Header profesional */
.main-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
  stroke-width: 2;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.user-avatar svg {
  width: 20px;
  height: 20px;
  color: white;
  stroke-width: 2;
}

.username {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.9375rem;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--gray-700);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.btn-logout:hover {
  background: var(--gray-200);
  border-color: var(--gray-300);
  transform: translateY(-1px);
}

/* Main content */
.main-content {
  min-height: calc(100vh - 73px);
  padding: 3rem 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Hero section */
.hero-section {
  margin-bottom: 3rem;
  text-align: center;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--gray-600);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Form card */
.form-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  margin-bottom: 2rem;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-header {
  padding: 2rem 2.5rem;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.02), rgba(139, 92, 246, 0.02));
}

.card-header h2,
.card-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-header h3 .icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
  stroke-width: 2;
}

.card-header p {
  color: var(--gray-600);
  font-size: 0.9375rem;
}

form {
  padding: 2.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-group,
.form-group-full {
  display: flex;
  flex-direction: column;
}

.form-group label,
.form-group-full label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.label-text {
  flex: 1;
}

.label-required {
  color: var(--error);
}

.form-group input,
.form-group select,
.form-group-full input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  transition: var(--transition);
  background: var(--gray-50);
}

.form-group input:focus,
.form-group select:focus,
.form-group-full input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-group small {
  color: var(--gray-500);
  font-size: 0.8125rem;
  margin-top: 0.375rem;
}

.form-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

/* Botones principales */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-large {
  padding: 1.25rem 3rem;
  font-size: 1.125rem;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), var(--success-light));
}

.btn-icon-left {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Logs card */
.logs-card {
  background: var(--gray-900);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  margin-bottom: 2rem;
  border: 1px solid var(--gray-800);
}

.logs-card .card-header {
  background: var(--gray-800);
  border-bottom-color: var(--gray-700);
}

.logs-card .card-header h3 {
  color: white;
}

.logs-content {
  padding: 1.5rem;
  max-height: 500px;
  overflow-y: auto;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  background: #0a0a0a;
}

.log-entry {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  display: flex;
  gap: 0.75rem;
  animation: logSlide 0.3s ease-out;
}

@keyframes logSlide {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.log-entry.info {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.log-entry.success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.log-entry.error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.log-entry.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

.log-timestamp {
  color: var(--gray-500);
  font-size: 0.75rem;
  white-space: nowrap;
}

.log-message {
  flex: 1;
}

.logs-content::-webkit-scrollbar {
  width: 8px;
}

.logs-content::-webkit-scrollbar-track {
  background: var(--gray-800);
}

.logs-content::-webkit-scrollbar-thumb {
  background: var(--gray-600);
  border-radius: var(--radius-sm);
}

.logs-content::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* Result cards */
.result-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 3rem;
  text-align: center;
  box-shadow: var(--shadow-xl);
  border: 2px solid;
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.result-card.success {
  border-color: var(--success);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(52, 211, 153, 0.05));
}

.result-card.error {
  border-color: var(--error);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(248, 113, 113, 0.05));
}

.result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 1.5rem;
}

.result-card.success .result-icon {
  background: var(--success);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.result-card.error .result-icon {
  background: var(--error);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.result-icon svg {
  width: 40px;
  height: 40px;
  color: white;
  stroke-width: 2.5;
}

.result-card h3 {
  font-size: 1.875rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.result-card.success h3 {
  color: var(--success);
}

.result-card.error h3 {
  color: var(--error);
}

.result-card p {
  color: var(--gray-600);
  font-size: 1.0625rem;
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .header-container {
    flex-direction: column;
    gap: 1rem;
  }

  .login-card {
    padding: 2rem;
  }

  .container {
    padding: 0 1rem;
  }

  form {
    padding: 1.5rem;
  }
}
/* Logos */
.logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  background: white;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(255, 140, 66, 0.3);
  padding: 1rem;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

#loginError {
  position: relative !important;
  z-index: 99999 !important;
}

.login-card {
  position: relative !important;
  z-index: 9999 !important;
}
/* Input de archivo - estilo minimalista */
/* Input de archivo */
.input-file {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--gray-50);
  cursor: pointer;
}

.input-file:hover {
  border-color: var(--primary);
  background: white;
}

.input-file:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-file::file-selector-button {
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.input-file::file-selector-button:hover {
  background: var(--primary-dark);
}

.label-optional {
  color: var(--gray-400);
  font-weight: 400;
  font-size: 0.8125rem;
  font-style: italic;
  margin-left: 4px;
}

#logoPreview {
  margin-top: 8px;
  display: inline-block; /* 👈 Esto es clave */
  max-width: 100px; /* 👈 Limitar contenedor */
}

#logoPreviewImg {
  width: 80px; /* 👈 Ancho fijo en lugar de max-width */
  height: auto; /* 👈 Mantener proporción */
  max-height: 40px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 4px;
  background: white;
  display: block;
  object-fit: contain; /* 👈 Importante para que no se deforme */
}