/**
 * Custom Authentication Pages Styles
 * Exact styling to match the provided designs
 */

/* CSS Variables for consistent theming */
:root {
  --primary-green: #00A479;
  --text-dark: #333333;
  --text-medium: #666666;
  --text-light: #999999;
  --background-white: #ffffff;
  --background-light: #f8f9fa;
  --border-color: #e1e5e9;
  --modal-overlay: rgba(0, 0, 0, 0.5);
  --success-green: #46b450;
  --error-red: #dc3232;
  --input-focus: rgba(0, 164, 121, 0.1);
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

/* Page containers */
.custom-auth-page {
  background-color: var(--background-white);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  padding-bottom: 60px;
}

.auth-container {
  max-width: 1216px;
  margin: 0 auto;
}

.auth-container-narrow {
  max-width: min(95%, 1216px);
  margin: 0 auto;
  padding: 2rem 0;
}

/* Registration Page Header */
.registration-header {
  background-color: var(--primary-green);
  color: white;
  padding: 60px 60px;
  text-align: center;
  margin: 65px 0 65px 0;
  border-radius: 0;
  border-radius: 6px;
  display: flex;
  flex-direction: row;
  gap: 60px;
}

.registration-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  line-height: 1.2;
  text-align: left;
}

.registration-header p {
  font-size: 1rem;
  margin: 0;
  opacity: 0.95;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* Page titles and subtitles */
.page-title {
  font-size: 40px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-medium);
  margin: 0 0 2rem 0;
  line-height: 1.5;
}

.page-subtitle a {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 500;
}

.page-subtitle a:hover {
  text-decoration: underline;
}

/* Form styling */
.auth-form {
  background-color: var(--background-white);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.form-field-full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  display: block;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  background-color: var(--background-white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 2px var(--input-focus);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-light);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary-green);
  color: white;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  font-family: inherit;
}

.btn-primary:hover {
  background-color: #008a66;
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  background-color: var(--text-light);
  cursor: not-allowed;
  transform: none;
}

/* Form actions */
.form-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.form-actions-right {
  justify-content: flex-end;
}

/* Links */
.forgot-password-link {
  color: var(--text-medium);
  text-decoration: underline;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: block;
}

.forgot-password-link:hover {
  color: var(--text-dark);
}

/* Success Modal */
.success-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.success-modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: white;
  padding: 3rem;
  border-radius: 8px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.success-modal.show .modal-content {
  transform: scale(1);
}

.modal-logo {
  margin-bottom: 1.5rem;
}

.modal-logo img {
  max-height: 60px;
  width: auto;
}

.modal-title {
  font-size: 24px;;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 1rem 0;
}

.modal-message {
  font-size: 1rem;
  color: var(--text-medium);
  margin: 0 0 2rem 0;
  line-height: 1.5;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text-dark);
}

/* Error and success messages */
.auth-errors,
.auth-success {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 4px;
  border-left: 4px solid;
}

.auth-errors {
  background-color: #fef2f2;
  border-left-color: var(--error-red);
  color: #991b1b;
}

.auth-success {
  background-color: #f0fdf4;
  border-left-color: var(--success-green);
  color: #166534;
}

.error-message,
.success-message {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

.error-message + .error-message,
.success-message + .success-message {
  margin-top: 0.5rem;
}

/* Password reset specific styles */
.reset-form-container {
  max-width: 500px;
  margin: 0 auto;
}

.reset-success-message {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid var(--success-green);
  border-radius: 4px;
  padding: 1rem;
  margin: 2rem 0;
  color: #166534;
}

.reset-success-message a {
  color: var(--primary-green);
  font-weight: 500;
  text-decoration: none;
}

.reset-success-message a:hover {
  text-decoration: underline;
}

/* Decorative elements */
.decorative-icon {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background-color: #e0f2fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.decorative-icon svg {
  width: 30px;
  height: 30px;
  color: #0284c7;
}

/* Loading states */
.btn-primary.loading {
  position: relative;
  color: transparent;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .auth-container,
  .auth-container-narrow {
    padding: 1rem;
  }
  
  .registration-header {
    margin: -1rem -1rem 2rem -1rem;
    padding: 2rem 1rem;
    flex-direction: column;
    gap: 1rem;
    border-radius: 0;
  }
  
  .registration-header h1 {
    font-size: 2rem;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .form-field-full {
    grid-column: 1;
  }
  
  .modal-content {
    margin: 1rem;
    padding: 2rem;
  }
  
  .modal-title {
    font-size: 1.5rem;
  }
  
  .decorative-icon {
    display: none;
  }
}

@media (max-width: 480px) {
  .auth-container,
  .auth-container-narrow {
    padding: 0.5rem;
  }
  
  .registration-header {
    margin: -0.5rem -0.5rem 1.5rem -0.5rem;
    padding: 1.5rem 0.5rem;
  }
  
  .registration-header h1 {
    font-size: 1.75rem;
  }
  
  .page-title {
    font-size: 1.75rem;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .btn-primary {
    width: 100%;
    padding: 1rem;
  }
  
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Print styles */
@media print {
  .success-modal,
  .decorative-icon,
  .btn-primary {
    display: none !important;
  }
  
  .auth-errors,
  .auth-success {
    border: 1px solid #ccc !important;
    background: none !important;
    color: #000 !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-light: #666666;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .success-modal,
  .modal-content,
  .btn-primary,
  .form-input,
  .form-select,
  .form-textarea {
    transition: none;
  }
  
  .btn-primary.loading::after {
    animation: none;
  }
}

/* Focus visible for better accessibility */
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible,
.btn-primary:focus-visible,
.auth-link:focus-visible {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

/* Custom scrollbar for modal */
.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--primary-green);
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: #008a66;
}