/* ===================================================================
   ANIMATIONS AND EFFECTS
   =================================================================== */

/* Slide Down Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shake Animation for Form Errors */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Slide In Animation */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bounce Animation for Success Icon */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0,0,0);
  }
  40%, 43% {
    transform: translate3d(0, -30px, 0);
  }
  70% {
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}

/* Spinner Animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Confetti Animation */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #10b981;
  animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(2n) { background: #3b82f6; animation-delay: 0.2s; }
.confetti:nth-child(3n) { background: #f59e0b; animation-delay: 0.4s; }
.confetti:nth-child(4n) { background: #ef4444; animation-delay: 0.6s; }
.confetti:nth-child(5n) { background: #8b5cf6; animation-delay: 0.8s; }

@keyframes confetti-fall {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(500px) rotate(720deg);
    opacity: 0;
  }
}

/* Confirmation Modal Animation */
#deviceConfirmationModal .modal {
  animation: confirmationSlideIn 0.3s ease-out;
}

@keyframes confirmationSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Success Checkmark Animation */
.success-checkmark {
  display: inline-block;
  animation: checkmark-pop 0.3s ease-out;
}

@keyframes checkmark-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ===================================================================
   FOOTER
   =================================================================== */

.footer {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--text-secondary);
  transition: background-color var(--duration-slow) ease, border-color var(--duration-slow) ease, color var(--duration-slow) ease;
}

/* ===================================================================
   RESPONSIVE DESIGN - TABLET AND DESKTOP
   =================================================================== */

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .nav-links {
    gap: 0.5rem;
  }

  .nav-links button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  .section {
    padding: 2rem;
  }

  .tiers-grid {
    grid-template-columns: 1fr;
  }

  .content-area {
    padding: 2rem 1rem 1rem;
  }

  /* !important: overrides inline display set by JS toggle */
  .plans-section {
    display: none !important;
  }

  /* !important: overrides the !important on .plans-section above */
  .plans-section.show {
    display: block !important;
  }
}

/* ===================================================================
   RESPONSIVE DESIGN - MOBILE DEVICES
   =================================================================== */

/* Support Grid Mobile Layout */
@media (max-width: 768px) {
  .support-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
  }

  .support-card {
    padding: 1.5rem;
  }

  .support-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  .support-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .support-card p {
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
  }

  .support-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    gap: 0.5rem;
  }
}

/* Modal Mobile Fixes */
@media (max-width: 768px) {
  .modal-overlay {
    /* Reduced padding on mobile */
    padding: 0.5rem;
    
    /* Use safe area for modern phones */
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .modal, .otp-modal, .success-modal {
    padding: 1.5rem;
    width: 100%;
    max-width: none;
    border-radius: 16px;
    
    /* More conservative height on mobile */
    max-height: 85vh;
    overflow-y: auto;
  }

  #deviceConfirmationModal .modal {
    padding: 1.5rem;
    /* Even more conservative for the large modal */
    max-height: 80vh;
    overflow-y: auto;
  }

  /* Smaller login tabs on mobile */
  .login-tab {
    font-size: 0.7rem;
    padding: 0.5rem 0.25rem;
  }
  
  /* Make form inputs more mobile-friendly */
  .form-input {
    padding: 0.75rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .submit-btn {
    padding: 0.875rem;
    font-size: 0.9rem;
  }

  /* Device warning adjustments */
  #deviceConfirmationModal .device-warning {
    padding: 0.75rem;
    margin: 0.75rem 0;
    border-radius: 8px;
  }
  
  #deviceConfirmationModal .device-warning p {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
  }
  
  #deviceConfirmationModal .device-warning li {
    font-size: 0.8rem;
    padding: 0.25rem 0;
    line-height: 1.2;
  }
  
  #deviceConfirmationModal .warning-box {
    padding: 0.5rem;
    margin-top: 0.5rem;
    border-radius: 6px;
  }
  
  #deviceConfirmationModal .warning-box strong {
    font-size: 0.9rem;
    line-height: 1.2;
  }
  
  #deviceConfirmationModal .confirmation-buttons {
    margin-top: 1rem;
    gap: 0.5rem;
    flex-direction: column;
  }
  
  #deviceConfirmationModal .confirmation-buttons button {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    width: 100%;
    border-radius: 6px;
  }
}

/* Extra Small Screens */
@media (max-width: 480px) {
  .support-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
  }

  .support-card {
    padding: 1.25rem;
    border-radius: 16px;
  }

  .support-icon {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .support-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .support-card p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.4;
  }

  .support-btn {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }

  /* !important: overrides inline display set by JS toggle */
  .plans-section {
    display: none !important;
  }

  /* !important: overrides the !important on .plans-section above */
  .plans-section.show {
    display: block !important;
  }

  /* Modal fixes for extra small screens */
  .modal-overlay {
    padding: 0.25rem;
    padding-top: max(0.25rem, env(safe-area-inset-top));
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
  }

  .modal, .otp-modal, .success-modal {
    padding: 1.25rem;
    border-radius: 12px;
    /* Very conservative height on small screens */
    max-height: 80vh;
  }

  #deviceConfirmationModal .modal {
    padding: 1.25rem;
    max-height: 75vh;
  }

  /* Extra compact device confirmation on small screens */
  #deviceConfirmationModal .modal h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  #deviceConfirmationModal .device-warning {
    padding: 0.5rem;
    margin: 0.5rem 0;
  }

  #deviceConfirmationModal .device-warning p {
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
  }

  #deviceConfirmationModal .device-warning li {
    font-size: 0.75rem;
    padding: 0.2rem 0;
  }

  #deviceConfirmationModal .warning-box {
    padding: 0.4rem;
    margin-top: 0.4rem;
  }

  #deviceConfirmationModal .warning-box strong {
    font-size: 0.85rem;
  }

  #deviceConfirmationModal .confirmation-buttons button {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
  }

  /* Compact modal titles */
  .modal h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
}

/* ===================================================================
   LANDSCAPE ORIENTATION FIXES
   =================================================================== */

@media (max-height: 600px) and (orientation: landscape) {
  .modal-overlay {
    padding: 0.25rem;
    /* On landscape, align to start to ensure visibility */
    align-items: flex-start;
    padding-top: 0.5rem;
  }

  .modal, .otp-modal, .success-modal {
    /* Very constrained height in landscape */
    max-height: 70vh;
    padding: 1rem;
  }

  #deviceConfirmationModal .modal {
    max-height: 65vh;
    padding: 1rem;
  }

  .modal h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  #deviceConfirmationModal .device-warning {
    padding: 0.75rem;
    margin: 0.75rem 0;
  }

  #deviceConfirmationModal .confirmation-buttons {
    margin-top: 1rem;
  }
}

/* Very Short Screens */
@media (max-height: 500px) {
  .modal-overlay {
    align-items: flex-start;
    padding-top: 0.25rem;
  }
  
  .modal, .otp-modal, .success-modal {
    max-height: 85vh;
    padding: 0.75rem;
  }

  #deviceConfirmationModal .modal {
    max-height: 80vh;
    padding: 0.75rem;
  }
}

/* ===================================================================
   UTILITY CLASSES AND HELPERS
   =================================================================== */

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .modal {
    border: 2px solid #000;
  }
  
  .btn-primary, .btn-secondary, .btn-tertiary {
    border: 2px solid #000;
  }
}

/* !important: accessibility — must override all animations for motion-sensitive users */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================================================
   EXTRACTED INLINE STYLES
   =================================================================== */

/* Nav button variants (replaces inline styles + onmouseover/onmouseout) */
.login-nav-btn-support {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  cursor: pointer;
  color: white;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  font-size: 0.9rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-nav-btn-support:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.login-nav-btn-guide {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  cursor: pointer;
  color: white;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  font-size: 0.9rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-nav-btn-guide:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* Tier price period suffix */
.tier-price-period {
  font-size: 1rem;
  font-weight: normal;
  color: #64748b;
}

/* OTP modal */
.otp-subtitle {
  color: #64748b;
  margin-bottom: 1.5rem;
}

.otp-resend-text {
  font-size: 0.875rem;
  color: #64748b;
}

/* Success modal */
.success-title {
  color: #15803d;
  margin-bottom: 1rem;
}

.success-subtitle {
  color: #64748b;
  margin-bottom: 1.5rem;
}

.success-credentials-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.success-credentials-box h3 {
  color: #15803d;
  margin-bottom: 1rem;
}

.success-credential-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.success-credential-label {
  color: #64748b;
  font-weight: 600;
}

.success-credential-value {
  color: #15803d;
  font-weight: 600;
}

.success-credential-pin {
  color: #15803d;
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.1rem;
}

.success-passkey-notice {
  margin-top: 1rem;
  padding: 0.5rem;
  background: #e6fffa;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #0d9488;
}

/* Guide modal */
.guide-modal-title {
  text-align: center;
  margin-bottom: 2rem;
}

.guide-intro {
  margin-bottom: 2rem;
}

.guide-intro p {
  text-align: center;
  color: #64748b;
}

.guide-steps {
  margin-bottom: 2rem;
}

.guide-step {
  background: #f8fafc;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.guide-step--green {
  border-left: 4px solid #10b981;
}

.guide-step--blue {
  border-left: 4px solid #1e40af;
}

.guide-step-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.guide-step-number {
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-right: 1rem;
}

.guide-step-number--green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.guide-step-number--blue {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

.guide-step-title {
  margin: 0;
  color: #1e293b;
}

.guide-step-text {
  color: #64748b;
  margin-bottom: 1rem;
}

.guide-step-btn {
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.guide-step-btn--green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.guide-step-btn--blue {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

/* Sign-in form inline guide button */
.login-inline-guide-btn {
  color: white;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border: 2px solid transparent;
  border-radius: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  cursor: pointer;
}

.login-inline-guide-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* PIN row layout (guide + forgot pin links) */
.login-pin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

/* Guide modal body sizing */
.guide-modal-body {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}