/* 
 * AUTH MODAL CSS - Apple-Grade Professional Design
 * Institut Loreta - Meticulously crafted authentication modal
 */

/* === MODAL OVERLAY & CONTAINER === */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-modal-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

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

/* === CLOSE BUTTON === */
.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 50%;
  color: #1d1d1f;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.auth-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.1);
}

.auth-modal-close:active {
  transform: scale(0.95);
}

/* === CONTENT AREA === */
.auth-modal-content {
  padding: 48px 40px 40px;
}

/* === TABS === */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  background: #f5f5f7;
  border-radius: 12px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #6e6e73;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.auth-tab:hover {
  color: #1d1d1f;
}

.auth-tab.active {
  background: #ffffff;
  color: #1d1d1f;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* === PANELS === */
.auth-panel {
  display: none;
  animation: fadeInPanel 0.3s ease;
}

.auth-panel.active {
  display: block;
}

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

/* === HEADER === */
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #FFFFFF;
  margin: 0 0 8px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.5px;
}

.auth-header p {
  font-size: 15px;
  color: #6e6e73;
  margin: 0;
}

/* === FORM === */
.auth-modal-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1.5px solid #d2d2d7;
  border-radius: 10px;
  background: #ffffff;
  color: #1d1d1f;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  outline: none;
  box-sizing: border-box;
}

.form-field input:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.form-field input::placeholder {
  color: #a1a1a6;
}

/* === PASSWORD WRAPPER === */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #86868b;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.password-toggle:hover {
  background: #f5f5f7;
  color: #1d1d1f;
}

.password-toggle.active {
  color: #0071e3;
}

/* === FIELD HINT === */
.field-hint {
  font-size: 12px;
  color: #86868b;
  margin-top: -4px;
}

.field-hint.field-match {
  font-weight: 600;
  margin-top: 6px;
  transition: all 0.2s ease;
}

/* === PASSWORD STRENGTH METER === */
.password-strength-meter {
  width: 100%;
}

.strength-bar {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.strength-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #e74c3c;
}

.strength-text {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  transition: color 0.3s ease;
}

/* === FORM OPTIONS === */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -8px;
}

/* === CHECKBOX === */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1d1d1f;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #0071e3;
  margin: 0;
}

.checkbox-label span {
  line-height: 1.5;
}

.checkbox-label a {
  color: #0071e3;
  text-decoration: none;
  font-weight: 500;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* === TEXT LINK === */
.text-link {
  font-size: 14px;
  color: #0071e3;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.text-link:hover {
  opacity: 0.8;
}

/* === SUBMIT BUTTON === */
.auth-submit-btn {
  width: 100%;
  padding: 14px 24px;
  margin-top: 8px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #0071e3 0%, #005bb5 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
  position: relative;
  overflow: hidden;
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.35);
}

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

.auth-submit-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.auth-submit-btn .btn-text {
  display: inline-block;
  transition: opacity 0.2s ease;
}

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

.auth-submit-btn .btn-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.auth-submit-btn.loading .btn-loader {
  opacity: 1;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === FOOTER === */
.auth-footer {
  margin-top: 24px;
  text-align: center;
}

.resend-link {
  font-size: 14px;
  color: #0071e3;
  text-decoration: none;
  font-weight: 500;
}

.resend-link:hover {
  text-decoration: underline;
}

/* === SUCCESS MESSAGE === */
.success-message {
  text-align: center;
  padding: 40px 20px;
  animation: fadeIn 0.3s ease;
}

.success-message svg {
  margin: 0 auto 24px;
  display: block;
}

.success-message h3 {
  font-size: 24px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 12px 0;
}

.success-message p {
  font-size: 15px;
  color: #6e6e73;
  line-height: 1.6;
  margin: 0;
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
  .auth-modal {
    padding: 0;
    align-items: flex-end;
  }

  .auth-modal-container {
    max-width: none;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  .auth-modal-content {
    padding: 40px 24px 32px;
  }

  .auth-header h2 {
    font-size: 24px;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
  .auth-modal,
  .auth-modal-container,
  .auth-panel,
  .success-message {
    animation: none !important;
  }
}

/* Focus visible for keyboard navigation */
.auth-modal *:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}

/* High contrast support */
@media (prefers-contrast: high) {
  .form-field input {
    border-width: 2px;
  }

  .auth-submit-btn {
    border: 2px solid #0071e3;
  }
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
  .auth-modal-container {
    background: #1c1c1e;
  }

  .auth-modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f7;
  }

  .auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .auth-tabs {
    background: #2c2c2e;
  }

  .auth-tab {
    color: #a1a1a6;
  }

  .auth-tab:hover {
    color: #f5f5f7;
  }

  .auth-tab.active {
    background: #3a3a3c;
    color: #f5f5f7;
  }

  .auth-header h2 {
    color: #f5f5f7;
  }

  .auth-header p,
  .field-hint {
    color: #a1a1a6;
  }

  .form-field label {
    color: #f5f5f7;
  }

  .form-field input {
    background: #2c2c2e;
    border-color: #48484a;
    color: #f5f5f7;
  }

  .form-field input::placeholder {
    color: #6e6e73;
  }

  .checkbox-label {
    color: #f5f5f7;
  }

  .success-message h3 {
    color: #f5f5f7;
  }

  .success-message p {
    color: #a1a1a6;
  }
}
