:root {
  --brand-color: #0870a2;
  --brand-hover: #065a7a;
  --brand-light: #e3f2fd;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --bg-light: #f9fafb;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #ffffff;
  margin: 0;
  padding: 0;
  color: var(--text-primary);
}

/* DESKTOP LAYOUT*/
.recovery-container {
  min-height: 100vh;
  max-width: 100vw;
  display: flex;
  gap: 2rem;
  padding: 2rem;
  box-sizing: border-box;
}

.form-column {
  flex: 0 0 calc(40% - 1rem);
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.image-column {
  flex: 0 0 calc(60% - 1rem);
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.recovery-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.form-content {
  width: 100%;
  max-width: 400px;
}

.logo-container {
  text-align: center;
  margin-bottom: 1.5rem; /* Match login page */
}

.logo-container img {
  height: 50px;
  width: auto;
}

.form-title {
  text-align: center;
  margin-bottom: 1.5rem; /* Match login page */
}

.form-title h1 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.form-title p {
  font-size: 0.8rem;
  color: var(--brand-color);
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
}

.form-group {
  margin-bottom: 1rem; /* Reduced from 1.25rem */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

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

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

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.form-control {
  height: 42px;
  padding: 10px 14px 10px 36px;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: #ffffff;
  transition: all 0.2s ease-in-out;
  width: 100%;
}

.form-control:focus {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 0.15rem rgba(8, 112, 162, 0.1);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.form-buttons {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.5rem; /* Reduced from 0.75rem */
  margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.btn-custom-primary,
.btn-custom-secondary {
  width: 100% !important;
  height: 42px;
  font-weight: 600;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s ease-in-out;
  position: relative;
  overflow: hidden;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  border: none;
  outline: none;
}

.btn-custom-primary {
  background-color: var(--brand-color) !important;
  border: 1px solid var(--brand-color) !important;
  color: white !important;
}

.btn-custom-secondary {
  background-color: transparent !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}

.btn-custom-primary:hover:not(:disabled) {
  background-color: var(--brand-hover) !important;
  border-color: var(--brand-hover) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(8, 112, 162, 0.3);
}

.btn-custom-secondary:hover:not(:disabled) {
  background-color: var(--bg-light) !important;
  border-color: var(--text-secondary) !important;
  color: var(--text-primary) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-custom-primary:focus,
.btn-custom-primary:focus-visible {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
  color: white !important;
  box-shadow: 0 0 0 0.2rem rgba(8, 112, 162, 0.25) !important;
  outline: none !important;
}

.btn-custom-secondary:focus,
.btn-custom-secondary:focus-visible {
  background-color: transparent !important;
  border-color: var(--text-secondary) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(156, 163, 175, 0.25) !important;
  outline: none !important;
}

.btn-custom-primary:active {
  background-color: var(--brand-hover) !important;
  border-color: var(--brand-hover) !important;
  color: white !important;
  transform: translateY(0);
}

.btn-custom-secondary:active {
  background-color: #f3f4f6 !important;
  border-color: var(--text-secondary) !important;
  color: var(--text-primary) !important;
  transform: translateY(0);
}

.btn-custom-primary:disabled {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
  color: white !important;
  opacity: 0.8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-custom-secondary:disabled {
  background-color: transparent !important;
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Loading state styles */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading .btn-text {
  opacity: 0;
}

.btn-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: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.btn-loading::before {
  content: "Enviando...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  margin-left: 12px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.security-notice {
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 1rem; /* Reduced from 1.25rem */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.security-notice .title {
  font-weight: 600;
  color: var(--brand-color);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.security-notice .text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.image-container {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 1.5rem;
  overflow: hidden;
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.footer-text {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2rem; /* Match login page footer spacing */
  line-height: 1.4;
}

.footer-text a {
  color: var(--brand-color);
  text-decoration: none;
  font-weight: 600;
}

.footer-text a:hover {
  text-decoration: underline;
}

#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.preloader {
  display: flex;
  gap: 10px;
}

.preloader span {
  width: 20px;
  height: 20px;
  background: var(--brand-color);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite both;
}

.preloader span:nth-child(1) {
  animation-delay: -0.32s;
}

.preloader span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Modern Sonner-style Toast Notifications */
.sonner-toaster {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 999999;
  pointer-events: none;
  padding: 1rem;
  width: 100%;
  max-width: 420px;
}

.sonner-toast {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  pointer-events: auto;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.sonner-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.sonner-toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

.sonner-toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.sonner-toast-content {
  flex: 1;
  min-width: 0;
}

.sonner-toast-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.sonner-toast-description {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.sonner-toast-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  font-size: 1rem;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sonner-toast-close:hover {
  background-color: var(--bg-light);
  color: var(--text-primary);
}

/* Toast variants */
.sonner-toast.success {
  border-left: 4px solid var(--success-color);
}

.sonner-toast.success .sonner-toast-icon {
  background-color: var(--success-color);
  color: white;
}

.sonner-toast.error {
  border-left: 4px solid var(--error-color);
}

.sonner-toast.error .sonner-toast-icon {
  background-color: var(--error-color);
  color: white;
}

.sonner-toast.warning {
  border-left: 4px solid var(--warning-color);
}

.sonner-toast.warning .sonner-toast-icon {
  background-color: var(--warning-color);
  color: white;
}

.sonner-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background-color: var(--brand-color);
  transition: width linear;
  border-radius: 0 0 0.75rem 0.75rem;
}

.sonner-toast.success .sonner-toast-progress {
  background-color: var(--success-color);
}

.sonner-toast.error .sonner-toast-progress {
  background-color: var(--error-color);
}

.sonner-toast.warning .sonner-toast-progress {
  background-color: var(--warning-color);
}

.btn-custom-secondary .btn-text,
.btn-custom-primary .btn-text {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  letter-spacing: 0;
}

/* ===== RESPONSIVE DESIGN - MOBILE FIRST APPROACH ===== */

/* LARGE DESKTOP */
@media (min-width: 1400px) {
  .recovery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem;
    gap: 3rem;
  }
}

/* DESKTOP */
@media (max-width: 1200px) {
  .recovery-container {
    padding: 1.5rem;
    gap: 1.5rem;
  }
}

/* LARGE TABLET LANDSCAPE - 1024px to 901px */
@media (max-width: 1024px) and (min-width: 901px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .recovery-container {
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    padding: 1.5rem;
    gap: 1.5rem;
  }

  .form-column {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .image-column {
    flex: 1 1 auto;
    width: 100%;
    display: flex !important;
    align-items: stretch;
    height: 100%;
    min-height: 0;
  }

  .recovery-card {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 1.5rem;
  }

  .image-container {
    width: 100%;
    height: 100%;
    border-radius: 1.5rem;
    min-height: 0;
    background-color: #f8fafc;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    max-width: 100%;
    max-height: 100%;
    display: block;
  }

  .form-content {
    max-width: 500px;
    margin: 0 auto;
  }
}

/* IPAD PRO & LARGE TABLETS - 900px to 835px */
@media (max-width: 900px) and (min-width: 835px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .recovery-container {
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    padding: 1.25rem;
    gap: 1.25rem;
  }

  .form-column {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .image-column {
    flex: 1 1 auto;
    width: 100%;
    display: flex !important;
    align-items: stretch;
    height: 100%;
    min-height: 0;
  }

  .recovery-card {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 1.75rem;
    border-radius: 1.25rem;
  }

  .image-container {
    width: 100%;
    height: 100%;
    border-radius: 1.25rem;
    min-height: 0;
    background-color: #f8fafc;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    max-width: 100%;
    max-height: 100%;
    display: block;
  }

  .form-content {
    max-width: 480px;
    margin: 0 auto;
  }

  .form-title h1 {
    font-size: 1.3rem;
  }

  .form-title p {
    font-size: 0.8rem;
  }
}

/* IPAD MINI & MEDIUM TABLETS - 834px to 769px */
@media (max-width: 834px) and (min-width: 769px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
  }

  .recovery-container {
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    padding: 1rem;
    gap: 1rem;
    display: flex;
  }

  .form-column {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .image-column {
    flex: 1 1 auto;
    width: 100%;
    display: flex !important;
    align-items: stretch;
    height: 100%;
    min-height: 0;
  }

  .recovery-card {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    border-radius: 1.25rem;
  }

  .image-container {
    width: 100%;
    height: 100%;
    border-radius: 1.25rem;
    min-height: 0;
    background-color: #f8fafc;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    max-width: 100%;
    max-height: 100%;
    display: block;
  }

  .form-content {
    max-width: 450px;
    margin: 0 auto;
  }

  .form-title h1 {
    font-size: 1.25rem;
  }

  .form-title p {
    font-size: 0.8rem;
  }

  .btn-custom-primary,
  .btn-custom-secondary {
    height: 44px;
    font-size: 0.9rem;
  }

  .security-notice {
    margin-top: 1.25rem;
    padding: 0.875rem;
  }

  .footer-text {
    margin-top: 1.25rem;
    font-size: 0.7rem;
  }
}

/* STANDARD TABLETS - 768px and below */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
  }

  .recovery-container {
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    gap: 1rem;
    padding: 1rem;
  }

  .form-column {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    order: 2;
  }

  .image-column {
    flex: 1 1 auto;
    width: 100%;
    display: flex !important;
    align-items: stretch;
    height: 100%;
    min-height: 0;
    order: 1;
  }

  .recovery-card {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 1.25rem 1rem;
    border-radius: 1rem;
  }

  .image-container {
    width: 100%;
    height: 100%;
    min-height: 300px;
    border-radius: 1rem;
    background-color: #f8fafc;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    max-width: 100%;
    max-height: 100%;
    display: block;
  }

  .logo-container {
    margin-bottom: 1rem;
  }

  .form-title {
    margin-bottom: 1rem;
  }

  .form-title h1 {
    font-size: 1.125rem;
  }

  .form-title p {
    font-size: 0.75rem;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .form-buttons {
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .btn-custom-primary,
  .btn-custom-secondary {
    height: 40px;
    font-size: 0.875rem;
  }

  .security-notice {
    margin-top: 1rem;
    padding: 0.75rem;
  }

  .security-notice .title {
    font-size: 0.8rem;
  }

  .security-notice .text {
    font-size: 0.75rem;
  }

  .footer-text {
    margin-top: 1rem;
    font-size: 0.65rem;
  }
}

/* MOBILE SMALL - 480px and below - Match index.php exactly */
@media (max-width: 480px) {
  .recovery-container {
    padding: 0.75rem;
    gap: 0;
    min-height: 100vh;
    height: 100vh;
    justify-content: center;
    align-items: center;
    flex-direction: column;
  }

  /* Hide image column on small mobile */
  .image-column {
    display: none !important;
  }

  .form-column {
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1 1 100%;
  }

  .recovery-card {
    padding: 1.5rem 1rem; /* Match login page padding */
    border-radius: 1rem;
    margin: 0 auto;
    max-width: 400px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .logo-container {
    margin-bottom: 1.5rem; /* Match login page logo spacing */
  }

  .logo-container img {
    height: 50px; /* Match login page logo size */
  }

  .form-title {
    margin-bottom: 1.5rem; /* Match login page title spacing */
  }

  .form-title h1 {
    font-size: 1.375rem; /* Match login page title size */
    margin-bottom: 0.5rem;
  }

  .form-title p {
    font-size: 0.8rem; /* Match login page subtitle size */
    line-height: 1.3;
  }

  .form-group {
    margin-bottom: 1rem; /* Keep consistent */
  }

  .btn-custom-primary,
  .btn-custom-secondary {
    height: 42px; /* Match login page button height */
    font-size: 0.875rem; /* Match login page button font size */
  }

  .form-buttons {
    gap: 0.5rem; /* Keep consistent */
    margin-bottom: 0.75rem;
  }

  .security-notice {
    margin-top: 1rem; /* Keep consistent */
    padding: 1rem;
  }

  .security-notice .title {
    font-size: 0.875rem; /* Match login page text size */
  }

  .security-notice .text {
    font-size: 0.8rem; /* Match login page text size */
  }

  .footer-text {
    margin-top: 2rem; /* Match login page footer spacing */
    font-size: 0.75rem; /* Match login page footer size */
  }
}

/* PHONES ONLY (NOT TABLETS) - Match index.php exactly */
@media (max-width: 600px) {
  .image-column {
    display: none !important;
  }

  .image-container {
    display: none !important;
  }

  .recovery-container {
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    height: 100vh;
    flex-direction: column;
    padding: 0.75rem;
    gap: 0;
  }

  .form-column {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1 1 100%;
  }

  .recovery-card {
    margin: 0 auto;
    max-width: 400px;
    width: 100%;
    border-radius: 1rem;
    padding: 1.5rem 1rem; /* Match login page exactly */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .form-content {
    width: 100%;
    max-width: 400px; /* Match login page max-width */
  }
}

/* LANDSCAPE ORIENTATION */
@media (max-height: 500px) and (orientation: landscape) {
  .recovery-container {
    flex-direction: row;
    gap: 1rem;
    padding: 1rem;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  .form-column {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .image-column {
    flex: 1 1 50%;
    display: flex !important;
    align-items: stretch;
    height: 100%;
  }

  .image-container {
    width: 100%;
    height: 100%;
    border-radius: 1rem;
    background-color: #f8fafc;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    max-width: 100%;
    max-height: 100%;
    display: block;
  }
}
