/* Auth Pages - Mobile-First Design */

:root {
  --auth-bg-gradient-start: rgba(31, 122, 90, 0.08);
  --auth-bg-gradient-end: rgba(74, 111, 165, 0.06);
  --auth-primary: #1F7A5A;
  --auth-primary-hover: #175C45;
  --auth-text: #1C1C1C;
  --auth-text-light: #5F6B6D;
  --auth-border: #E2E6E4;
  --auth-surface: #FFFFFF;
  --auth-bg: #F6F8F7;
}

/* Base Styles */
.auth-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--auth-bg);
  position: relative;
  overflow-x: hidden;
}

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-3);
  position: relative;
  z-index: 1;
}

.auth-wrapper {
  width: 100%;
  max-width: 440px;
  background: var(--auth-surface);
  border-radius: var(--r-md);
  padding: var(--s-6) var(--s-4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 2;
}

/* Header */
.auth-header {
  text-align: center;
  margin-bottom: var(--s-6);
}

@media (min-width: 768px) {
  .auth-header {
    margin-bottom: var(--s-8);
  }
}

.auth-logo {
  display: inline-block;
  margin-bottom: var(--s-6);
}

.auth-logo img {
  height: 40px;
  width: auto;
}

.auth-title {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 700;
  color: var(--auth-text);
  margin: 0 0 var(--s-2) 0;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: clamp(14px, 3vw, 16px);
  color: var(--auth-text-light);
  margin: 0;
  line-height: 1.5;
}

/* Forms */
.auth-form {
  margin-bottom: var(--s-6);
}

.form-group {
  margin-bottom: var(--s-4);
}

@media (min-width: 768px) {
  .form-group {
    margin-bottom: var(--s-5);
  }
}

.form-group-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
}

/* Form Row - Stack on Mobile */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}

@media (min-width: 480px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.form-label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: var(--s-2);
}

.form-label i {
  color: var(--auth-primary);
  font-size: 16px;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* Prevents zoom on iOS */
  line-height: 1.5;
  color: var(--auth-text);
  background: var(--auth-surface);
  border: 2px solid var(--auth-border);
  border-radius: var(--r-sm);
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

/* Prevent zoom on iOS when focusing inputs */
@media screen and (max-width: 768px) {
  .form-control {
    font-size: 16px !important;
  }
}

.form-control:focus {
  outline: none;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.1);
}

.form-control::placeholder {
  color: var(--auth-text-light);
  opacity: 0.6;
}

.form-control.is-valid {
  border-color: #28a745;
}

.form-control.is-invalid {
  border-color: #dc3545;
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: var(--s-2);
  font-size: 14px;
  color: #dc3545;
}

.form-text {
  display: block;
  margin-top: var(--s-2);
  font-size: 13px;
  color: var(--auth-text-light);
}

/* Password Input */
.password-input-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--auth-text-light);
  cursor: pointer;
  padding: 10px; /* Larger touch target */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  z-index: 1;
  min-width: 44px; /* Minimum touch target size */
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.password-toggle:hover {
  color: var(--auth-primary);
}

.password-toggle i {
  font-size: 18px;
}

/* Checkbox */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin-bottom: 0;
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
  min-width: 20px; /* Better touch target */
  -webkit-tap-highlight-color: transparent;
}

.form-check-label {
  font-size: 14px;
  color: var(--auth-text-light);
  line-height: 1.5;
  cursor: pointer;
  margin: 0;
}

/* Buttons */
.btn-auth-primary {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--auth-primary) 0%, #2A9D7A 100%);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px rgba(31, 122, 90, 0.3);
  margin-top: var(--s-6);
  min-height: 48px; /* Minimum touch target size */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* Prevents double-tap zoom */
}

.btn-auth-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--auth-primary-hover) 0%, var(--auth-primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(31, 122, 90, 0.4);
}

.btn-auth-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-auth-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-auth-primary i {
  font-size: 18px;
}

/* Links */
.forgot-password-link {
  font-size: 14px;
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  padding: var(--s-1);
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.forgot-password-link:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

.auth-link {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
  padding: var(--s-1);
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.auth-link:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

/* Footer */
.auth-footer {
  text-align: center;
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--auth-border);
}

@media (min-width: 768px) {
  .auth-footer {
    margin-top: var(--s-6);
    padding-top: var(--s-6);
  }
}

.auth-footer-text {
  font-size: 14px;
  color: var(--auth-text-light);
  margin: 0;
}

.auth-back-link {
  text-align: center;
  margin-top: var(--s-4);
}

@media (min-width: 768px) {
  .auth-back-link {
    margin-top: var(--s-5);
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 14px;
  color: var(--auth-text-light);
  text-decoration: none;
  transition: color 0.2s;
  padding: var(--s-2);
  min-height: 44px; /* Better touch target */
  -webkit-tap-highlight-color: transparent;
}

.back-link:hover {
  color: var(--auth-primary);
}

.back-link i {
  font-size: 16px;
}

/* Alerts */
.alert {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  margin-bottom: var(--s-4);
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

@media (min-width: 768px) {
  .alert {
    padding: 14px 16px;
    margin-bottom: var(--s-5);
    gap: var(--s-3);
  }
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert i {
  font-size: 18px;
  flex-shrink: 0;
}

/* Background */
.auth-background {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-bg-gradient {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(135deg, 
    var(--auth-bg-gradient-start) 0%, 
    var(--auth-bg-gradient-end) 50%,
    var(--auth-bg-gradient-start) 100%);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
  opacity: 0.6;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Small Mobile Improvements */
@media (max-width: 374px) {
  .auth-container {
    padding: var(--s-2);
  }

  .auth-wrapper {
    padding: var(--s-5) var(--s-3);
    border-radius: var(--r-sm);
  }

  .auth-title {
    font-size: 22px;
  }

  .form-control {
    padding: 12px 14px;
  }

  .btn-auth-primary {
    padding: 14px;
  }
}

/* Tablet and Up */
@media (min-width: 768px) {
  .auth-container {
    padding: var(--s-6);
  }

  .auth-wrapper {
    padding: var(--s-10) var(--s-8);
    border-radius: var(--r-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  }

  .auth-title {
    font-size: 36px;
  }

  .auth-subtitle {
    font-size: 18px;
  }
}

/* Desktop */
@media (min-width: 992px) {
  .auth-wrapper {
    max-width: 480px;
    padding: var(--s-10) var(--s-10);
  }
}

/* Large Screens */
@media (min-width: 1200px) {
  .auth-wrapper {
    max-width: 520px;
  }
}

/* Spinner for loading state */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}

.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to {
    transform: rotate(360deg);
  }
}

