/* css/modules/family-auth.css */
/* Family Auth Module - Mobile landing page styling */
/* Matches the look and feel of login/index.html */

.family-auth-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: #FCFCFF;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  /* iOS safe area support - ensures content isn't behind home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.family-auth-modal {
  background: #FCFCFF;
  border-radius: 0;
  padding: 40px;
  max-width: 500px;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  color: #424242;
  box-sizing: border-box;
}

.family-auth-logo {
  width: 150px;
  height: auto;
  margin: 0 auto 20px auto;
  display: block;
}

/* Larger logo for landing page */
.family-auth-logo-large {
  width: 200px;
  margin-bottom: 24px;
}

/* Back button - at top of modal */
.family-auth-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  background: transparent;
  border: none;
  color: #ff9500;
  font-size: 17px;
  font-weight: 400;
  cursor: pointer;
  padding: 8px 12px;
  margin: -20px -8px 20px -8px;
  transition: opacity 0.2s;
}

.family-auth-back-btn:active {
  opacity: 0.6;
}

.family-auth-back-btn svg {
  width: 20px;
  height: 20px;
}

/* Main content area (logo, header, buttons) - centers vertically */
.family-auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* Header */
.family-auth-header {
  margin-bottom: 30px;
}

.family-auth-header h2 {
  color: #424242;
  margin: 0 0 10px 0;
  font-size: 28px;
  font-weight: bold;
}

.family-auth-header p {
  color: #616161;
  margin: 0;
  font-size: 16px;
}

/* Tagline - italic style like original login */
.family-auth-tagline {
  color: #616161;
  font-size: 16px;
  font-style: italic;
  margin: 0;
}

/* Content */
.family-auth-content {
  margin: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Buttons */
.family-auth-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.family-auth-btn-primary {
  background: linear-gradient(135deg, #ff9500 0%, #ffaa00 100%);
  color: #ffffff;
}

.family-auth-btn-primary:hover {
  background: linear-gradient(135deg, #ffaa00 0%, #ffbb22 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

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

/* Google sign-in button style */
.family-auth-btn-google {
  background: #FFFFFF;
  color: #424242;
  border: 2px solid #E0E0E0;
}

.family-auth-btn-google:hover {
  background: #FFFFFF;
  border-color: #4285F4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

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

.btn-icon-google {
  background: transparent !important;
}

/* Spinner for Google button (blue instead of white) */
.btn-icon-google .spinner {
  border-color: rgba(66, 133, 244, 0.2);
  border-top-color: #4285F4;
  width: 24px;
  height: 24px;
  margin: 0;
}

.family-auth-btn-secondary {
  background: #F5F5F5;
  color: #424242;
  border: 2px solid #E0E0E0;
}

.family-auth-btn-secondary:hover {
  background: #FFFFFF;
  border-color: #ffaa00;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.family-auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.family-auth-btn:disabled:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Button icon */
.btn-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.family-auth-btn-secondary .btn-icon {
  background: rgba(0, 0, 0, 0.05);
}

.btn-icon svg {
  width: 24px;
  height: 24px;
}

/* Button content */
.btn-content {
  flex: 1;
  text-align: left;
}

.btn-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.btn-subtitle {
  font-size: 14px;
  font-weight: normal;
  opacity: 0.9;
}

/* Divider */
.family-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9E9E9E;
  font-size: 14px;
  margin: 10px 0;
}

.family-auth-divider::before,
.family-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #E0E0E0;
}

/* Form styling */
.family-auth-form {
  margin: 20px 0;
}

.family-auth-input-group {
  margin-bottom: 20px;
  text-align: left;
}

.family-auth-input-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #424242;
}

.family-auth-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  font-size: 18px;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  transition: all 0.2s;
  box-sizing: border-box;
}

.family-auth-input:focus {
  outline: none;
  border-color: #ffaa00;
  box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.1);
}

.family-auth-input::placeholder {
  color: #BDBDC1;
  letter-spacing: 1px;
}

.family-auth-hint {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: #757575;
  font-style: italic;
}

/* Error message */
.family-auth-error {
  background: #FFEBEE;
  border: 1px solid #EF5350;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #C62828;
  text-align: left;
}

/* Actions */
.family-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

/* Footer - stays at bottom */
.family-auth-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #E0E0E0;
  flex-shrink: 0;
}

.privacy-notice {
  color: #757575;
  font-size: 14px;
  margin: 0 0 12px 0;
}

.legal-links {
  font-size: 13px;
  color: #9E9E9E;
}

.legal-links a {
  color: #9E9E9E;
  text-decoration: none;
  transition: color 0.2s;
}

.legal-links a:hover {
  color: #ffaa00;
}

.legal-links .separator {
  margin: 0 8px;
}

.app-version {
  color: #9E9E9E;
  font-size: 11px;
  margin: 12px 0 0 0;
}

/* Loading state */
.family-auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 20px;
}

.family-auth-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 149, 0, 0.1);
  border-top-color: #ff9500;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.family-auth-loading p {
  color: #616161;
  font-size: 16px;
  font-weight: 500;
}

/* Success state */
.family-auth-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 20px;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: white;
  font-weight: bold;
  animation: successPop 0.5s ease-out;
}

/* Orange success icon variant */
.success-icon-orange {
  background: linear-gradient(135deg, #ff9500 0%, #ffaa00 100%);
  box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

@keyframes successPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.family-auth-success h2 {
  color: #424242;
  margin: 0;
  font-size: 24px;
}

.family-auth-success p {
  color: #616161;
  margin: 0;
  font-size: 16px;
}

.loading-text {
  color: #757575;
  font-size: 14px;
  font-style: italic;
}

/* Error state */
.family-auth-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 20px;
}

.error-icon {
  font-size: 64px;
}

.family-auth-error-state h2 {
  color: #424242;
  margin: 0;
}

.family-auth-error-state p {
  color: #616161;
  margin: 0;
  font-size: 16px;
  text-align: center;
}

/* Button spinner (for loading state on submit) */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
  .family-auth-modal {
    padding: 30px 20px;
    max-width: 100%;
    width: 100%;
    /* Safe area for iOS home indicator */
    padding-bottom: max(30px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  }

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

  .family-auth-btn {
    padding: 16px 20px;
  }

  .btn-title {
    font-size: 16px;
  }

  .btn-subtitle {
    font-size: 13px;
  }

  /* When keyboard may be open, don't center vertically - let content flow from top
     This allows the form to scroll and keeps the submit button visible */
  .family-auth-main {
    justify-content: flex-start;
    padding-top: 20px;
  }

  /* Ensure form actions have enough bottom margin for scroll visibility */
  .family-auth-form {
    padding-bottom: 40px;
  }

  /* Footer can shrink/hide when space is limited */
  .family-auth-footer {
    flex-shrink: 1;
    min-height: 0;
  }
}

/* Larger screens - constrain width but fill height */
@media (min-width: 601px) {
  .family-auth-modal {
    max-width: 600px;
    padding: 60px 50px;
  }

  .family-auth-logo {
    width: 180px;
  }

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

  .family-auth-header p {
    font-size: 18px;
  }
}

/* Dark mode support (optional - matches existing theme system) */
@media (prefers-color-scheme: dark) {
  .family-auth-container {
    background: #1E1E1E;
  }

  .family-auth-modal {
    background: #1E1E1E;
    color: #E0E0E0;
  }

  .family-auth-header h2 {
    color: #FFFFFF;
  }

  .family-auth-header p,
  .privacy-notice,
  .family-auth-loading p,
  .family-auth-success p {
    color: #B0B0B0;
  }

  .family-auth-btn-secondary {
    background: #2A2A2A;
    color: #E0E0E0;
    border-color: #3A3A3A;
  }

  .family-auth-btn-secondary:hover {
    background: #333333;
    border-color: #ffaa00;
  }

  .family-auth-input {
    background: #2A2A2A;
    border-color: #3A3A3A;
    color: #FFFFFF;
  }

  .family-auth-input:focus {
    background: #333333;
    border-color: #ffaa00;
  }

  .family-auth-divider::before,
  .family-auth-divider::after {
    background: #3A3A3A;
  }

  .family-auth-footer {
    border-top-color: #3A3A3A;
  }

  .legal-links a {
    color: #B0B0B0;
  }

  .legal-links a:hover {
    color: #ffaa00;
  }

  .family-auth-btn-google {
    background: #2A2A2A;
    color: #E0E0E0;
    border-color: #3A3A3A;
  }

  .family-auth-btn-google:hover {
    background: #333333;
    border-color: #4285F4;
  }
}
