/**
 * Login Page Styles
 * Estilos optimizados para la página de inicio de sesión
 * Compilado desde Tailwind CSS para mejor performance
 */

/* ========================================
   IMPORT FONTS
   ======================================== */
@import url('fonts.css');

/* ========================================
   CSS VARIABLES (Theme Colors)
   ======================================== */
:root {
  --apple-blue: #007AFF;
  --apple-blue-hover: #0051D5;
  --apple-gray: #F2F2F7;
  --apple-dark: #1C1C1E;
  --border-color: #E5E5EA;
  --error-red: #FF3B30;
  --success-green: #34C759;
  --warning-yellow: #fab520;
  --warning-yellow-hover: #fab520;
  --info-blue: #007AFF;
}

/* ========================================
   BASE STYLES
   ======================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: white;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   LAYOUT CONTAINER
   ======================================== */
.login-container {
  height: 100vh;
  display: flex;
}

/* ========================================
   IMAGE PANEL (Left Side)
   ======================================== */
.image-panel {
  display: none;
  width: 65%;
  position: relative;
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, rgba(0, 122, 255, 0.1), transparent, rgba(0, 0, 0, 0.3));
  z-index: 1;
}

.background-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (min-width: 1024px) {
  .image-panel {
    display: block;
  }
}

/* ========================================
   FORM PANEL (Right Side)
   ======================================== */
.form-panel {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: white;
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .form-panel {
    width: 35%;
    padding: 3rem;
  }
}

.form-container {
  width: 100%;
  max-width: 28rem;
  margin: auto 0;
}

/* ========================================
   LOGO & HEADER
   ======================================== */
.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
}

.logo {
  height: 4rem;
  max-width: 100%;
  object-fit: contain;
}

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

.header-title {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--apple-dark);
  margin-bottom: 0.5rem;
}

.header-subtitle {
  font-size: 1rem;
  color: #6B7280;
}

/* ========================================
   FLASH MESSAGES
   ======================================== */
.flash-messages {
  margin-bottom: 1.5rem;
}

.flash-message {
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  animation: slideIn 0.3s ease-out;
}

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

.flash-message.error {
  background-color: #FEF2F2;
  color: #991B1B;
  border-color: #FECACA;
}

.flash-message.success {
  background-color: #F0FDF4;
  color: #166534;
  border-color: #BBF7D0;
}

.flash-message.warning {
  background-color: #FFFBEB;
  color: #92400E;
  border-color: #FDE68A;
}

.flash-message.info {
  background-color: #EFF6FF;
  color: #1E40AF;
  border-color: #BFDBFE;
}

.flash-message i {
  font-size: 1rem;
  flex-shrink: 0;
}

.flash-message p {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: #9CA3AF;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background-color: rgba(242, 242, 247, 0.5);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus {
  background-color: white;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-input.has-toggle {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #9CA3AF;
  transition: color 0.2s;
  padding: 0.5rem;
}

.password-toggle:hover {
  color: #4B5563;
}

.error-message {
  font-size: 0.875rem;
  color: var(--error-red);
  margin-top: 0.25rem;
}

/* ========================================
   REMEMBER & FORGOT PASSWORD
   ======================================== */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.remember-me input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid #D1D5DB;
  cursor: pointer;
}

.remember-me input[type="checkbox"]:checked {
  background-color: var(--apple-blue);
  border-color: var(--apple-blue);
}

.remember-me label {
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
}

.forgot-password {
  font-size: 0.875rem;
  color: var(--apple-blue);
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-password:hover {
  color: var(--apple-blue-hover);
}

/* ========================================
   SUBMIT BUTTON
   ======================================== */
.submit-button {
  width: 100%;
  background-color: var(--warning-yellow);
  color: #000000;
  font-weight: 600;
  font-size: 1rem;
  padding: 1rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.submit-button:hover:not(:disabled) {
  background-color: var(--warning-yellow-hover);
  transform: translateY(0px);
}

.submit-button:active:not(:disabled) {
  transform: scale(0.99);
}

.submit-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

.submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading spinner */
.submit-button.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: #000000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (min-width: 640px) {
  .form-panel {
    padding: 2rem;
  }
}

@media (min-width: 768px) {
  .form-container {
    max-width: 32rem;
  }
  
  .header-title {
    font-size: 2.25rem;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--apple-blue);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .form-input {
    border-width: 2px;
  }
  
  .submit-button {
    border: 2px solid #000000;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
