/* ==========================================
   RESET Y VARIABLES
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --green-primary: #1a1a2e;
  --green-dark: #16213e;
  --yellow-primary: #f9b233;
  --yellow-dark: #e09d1f;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg-white: #ffffff;
  --bg-gray: #f8fafc;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --error-color: #ef4444;
  --success-color: #10b981;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-gray);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==========================================
   LAYOUT PRINCIPAL
   ========================================== */
.container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* Panel izquierdo */
.left-panel {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 3rem;
  position: relative;
}

.brand-section {
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.logo-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.logo-hero-icon {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.brand-name {
  font-size: 4.5rem;
  font-weight: 700;
  margin-bottom: 0;
  letter-spacing: -2px;
  line-height: 1;
}

.brand-core {
  color: white;
}

.brand-data {
  color: var(--yellow-primary);
}

.brand-tagline {
  font-size: 2rem;
  opacity: 0.95;
  font-weight: 400;
  color: white;
}

/* Panel derecho */
.right-panel {
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
}

.form-container {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ==========================================
   ENCABEZADO DEL FORMULARIO
   ========================================== */
.form-header {
  margin-bottom: 2.5rem;
  text-align: left;
}

.form-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.form-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ==========================================
   FORMULARIO
   ========================================== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: var(--bg-white);
  color: var(--text-dark);
}

.form-group input:focus {
  outline: none;
  border-color: var(--green-primary);
  box-shadow: 0 0 0 3px rgba(26, 122, 78, 0.1);
}

.form-group input::placeholder {
  color: var(--text-light);
}

.form-group input:disabled {
  background: var(--bg-gray);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Wrapper para inputs con botón */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 3rem;
}

.toggle-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn:hover {
  color: var(--green-primary);
}

/* Mensajes de error */
.error-message {
  display: block;
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 0.375rem;
  min-height: 1.25rem;
}

.form-group small {
  display: block;
  color: var(--text-light);
  font-size: 0.75rem;
  margin-top: 0.375rem;
}

/* ==========================================
   OPCIONES DEL FORMULARIO
   ========================================== */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

/* Checkbox personalizado */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--green-primary);
}

.checkbox-wrapper span {
  color: var(--text-dark);
  font-size: 0.875rem;
}

/* Enlaces */
.link-text {
  color: var(--green-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.link-text:hover {
  color: var(--green-dark);
  text-decoration: underline;
}

/* ==========================================
   BOTONES
   ========================================== */
.btn-primary,
.btn-secondary {
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  width: 100%;
}

.btn-primary {
  background: var(--green-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 122, 78, 0.2);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-gray);
  color: var(--text-dark);
  border: 2px solid var(--border-light);
  width: auto;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-light);
  border-color: var(--border-medium);
}

/* Spinner de carga */
.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

button:disabled .btn-content {
  display: none;
}

button:disabled .spinner {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   DIVISOR
   ========================================== */
.divider {
  position: relative;
  text-align: center;
  margin: 2rem 0;
}

.divider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border-light);
}

.divider span {
  position: relative;
  background: var(--bg-white);
  padding: 0 1rem;
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ==========================================
   FOOTER
   ========================================== */
.footer-links {
  text-align: center;
  margin-top: 1.5rem;
}

.footer-links p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links a {
  color: var(--green-primary);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.page-footer {
  text-align: center;
  margin-top: 2rem;
}

.page-footer p {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--green-primary);
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10000;
  max-width: 350px;
  display: none;
}

.toast[style*="display: block"] {
  display: block;
  transform: translateX(0);
  opacity: 1;
}

.toast.error {
  border-left-color: var(--error-color);
}

.toast.success {
  border-left-color: var(--success-color);
}

/* ==========================================
   MODALES
   ========================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal[style*="display: flex"],
.modal.active {
  display: flex;
}

.modal-dialog {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--bg-gray);
  color: var(--text-dark);
}

.modal-body {
  padding: 2rem;
}

.modal-body > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  flex: 1;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
  }
  
  .left-panel {
    display: none;
  }
  
  .right-panel {
    padding: 2rem;
  }
}

@media (max-width: 640px) {
  .right-panel {
    padding: 1.5rem;
  }
  
  .form-container {
    padding: 0;
  }
  
  .form-header h2 {
    font-size: 1.75rem;
  }
  
  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .modal {
    padding: 1rem;
  }
  
  .modal-dialog {
    max-width: 100%;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .toast {
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

/* ==========================================
   ESTADOS DE VALIDACIÓN
   ========================================== */
.form-group input.error {
  border-color: var(--error-color);
}

.form-group input.success {
  border-color: var(--success-color);
}

/* ==========================================
   UTILIDADES
   ========================================== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 1rem;
}