/**
 * Digital Church Authentication Styles
 * 
 * Modern authentication UI with glassmorphism effects and enhanced UX
 * Designed for the standalone /auth page template
 */

/* Import Inter font as fallback */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Custom Properties for theming */
:root {
  /* Primary colors */
  --dc-primary: #6366f1;
  --dc-primary-light: #818cf8;
  --dc-primary-dark: #4f46e5;
  --dc-primary-50: #eef2ff;
  --dc-primary-100: #e0e7ff;
  --dc-primary-600: #6366f1;
  --dc-primary-700: #5b21b6;
  
  /* Neutral colors */
  --dc-white: #ffffff;
  --dc-black: #000000;
  --dc-gray-50: #f9fafb;
  --dc-gray-100: #f3f4f6;
  --dc-gray-200: #e5e7eb;
  --dc-gray-300: #d1d5db;
  --dc-gray-400: #9ca3af;
  --dc-gray-500: #6b7280;
  --dc-gray-600: #4b5563;
  --dc-gray-700: #374151;
  --dc-gray-800: #1f2937;
  --dc-gray-900: #111827;
  
  /* Status colors */
  --dc-success: #10b981;
  --dc-success-light: #34d399;
  --dc-success-bg: #d1fae5;
  --dc-error: #ef4444;
  --dc-error-light: #f87171;
  --dc-error-bg: #fee2e2;
  --dc-warning: #f59e0b;
  --dc-warning-bg: #fef3c7;
  
  /* Spacing */
  --dc-space-xs: 0.25rem;
  --dc-space-sm: 0.5rem;
  --dc-space-md: 1rem;
  --dc-space-lg: 1.5rem;
  --dc-space-xl: 2rem;
  --dc-space-2xl: 3rem;
  --dc-space-3xl: 4rem;
  
  /* Border radius */
  --dc-radius-sm: 0.375rem;
  --dc-radius-md: 0.5rem;
  --dc-radius-lg: 0.75rem;
  --dc-radius-xl: 1rem;
  --dc-radius-2xl: 1.5rem;
  
  /* Shadows */
  --dc-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --dc-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --dc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --dc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Typography */
  --dc-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --dc-font-size-xs: 0.75rem;
  --dc-font-size-sm: 0.875rem;
  --dc-font-size-base: 1rem;
  --dc-font-size-lg: 1.125rem;
  --dc-font-size-xl: 1.25rem;
  --dc-font-size-2xl: 1.5rem;
  --dc-font-size-3xl: 1.875rem;
  --dc-font-size-4xl: 2.25rem;
  
  /* Transitions */
  --dc-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --dc-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Auth Page Layout */

body.dc-auth-page {
  margin: 0;
  padding: 0;
  font-family: var(--dc-font-family);
  line-height: 1.6;
  color: var(--dc-gray-900);
  background-color: #f9fafc;
  min-height: 100vh;
  overflow-x: hidden;
}

.dc-auth-container {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--dc-space-md);
}

/* Background Elements - Using Custom SVG */

/* Main Auth Card */
.dc-auth-main {
  width: 100%;
  max-width: 420px;
  z-index: 1;
  /* Move up by approximately half the logo height + margin to center the card */
  margin-top: -56px; /* (80px logo + 32px margin) / 2 = 56px */
}

/* Site Logo Above Card */
.dc-auth-logo-container {
  text-align: center;
  margin-bottom: var(--dc-space-xl);
  animation: dc-logo-appear 0.4s ease-out 0.2s both;
}

.dc-auth-logo {
  display: inline-block;
  text-decoration: none;
  transition: var(--dc-transition);
}

.dc-auth-logo:hover {
  transform: scale(1.05);
}

.dc-auth-logo-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.dc-auth-card {
  border-radius: 12px;
  border: none;
  padding: var(--dc-space-2xl);
  
  /* Exact neumorphic shadow from login.css */
  box-shadow: -4px -4px 8px #FFFFFF, 4px 4px 8px #DDE3EE !important;
  -webkit-box-shadow: -4px -4px 8px #FFFFFF, 4px 4px 8px #DDE3EE !important;
  -moz-box-shadow: -4px -4px 8px #FFFFFF, 4px 4px 8px #DDE3EE !important;
  
  animation: dc-card-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: translateY(20px);
  opacity: 0;
}

@keyframes dc-card-appear {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes dc-logo-appear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Header Section */
.dc-auth-header {
  text-align: center;
  margin-bottom: var(--dc-space-xl);
}

.dc-auth-title {
  font-size: var(--dc-font-size-3xl);
  font-weight: 600;
  color: var(--dc-gray-900);
  margin: 0 0 var(--dc-space-sm) 0;
  letter-spacing: -0.02em;
}

.dc-auth-subtitle {
  font-size: var(--dc-font-size-base);
  color: var(--dc-gray-600);
  margin: 0;
}

/* Content Area */
.dc-auth-content {
  margin-bottom: var(--dc-space-xl);
}

/* Auth Root Container */
#dc-auth-root {
  font-family: var(--dc-font-family);
}

/* Form Elements */
.dc-auth-input {
  width: 100%;
  padding: var(--dc-space-md) var(--dc-space-lg);
  font-size: var(--dc-font-size-base);
  line-height: 1.5;
  color: var(--dc-gray-900);
  background-color: #f9fafc;
  border: 1px solid #dde3ee;
  border-radius: 12px;
  transition: var(--dc-transition);
  box-sizing: border-box;
  font-family: var(--dc-font-family);
  
  /* Simple inset shadow like login form */
  box-shadow: inset 2px 2px 4px #DDE3EE, inset -2px -2px 4px #FFFFFF;
}

.dc-auth-input:focus {
  outline: none;
  border-color: #4452ff;
  box-shadow: 
    inset 2px 2px 4px #DDE3EE, 
    inset -2px -2px 4px #FFFFFF,
    0 0 0 2px rgba(68, 82, 255, 0.2);
}

.dc-auth-input::placeholder {
  color: var(--dc-gray-400);
  font-weight: 400;
}

.dc-auth-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f0f2f5;
}

.dc-auth-button {
  width: 100%;
  padding: var(--dc-space-md) var(--dc-space-lg);
  font-size: var(--dc-font-size-base);
  font-weight: 600;
  line-height: 1.5;
  color: var(--dc-white);
  background-color: #4452ff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--dc-transition);
  box-sizing: border-box;
  font-family: var(--dc-font-family);
}

/* Simplified hover without animated shine */
.dc-auth-button:hover {
  background-color: #4352fa;
}

.dc-auth-button:active {
  background-color: #3a47e6;
}

.dc-auth-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--dc-shadow-sm);
}

/* Links */
.dc-auth-link {
  color: var(--dc-primary);
  text-decoration: none;
  font-size: var(--dc-font-size-sm);
  font-weight: 500;
  transition: var(--dc-transition);
}

.dc-auth-link:hover {
  color: var(--dc-primary-dark);
  text-decoration: underline;
}

/* Status Messages */
.dc-auth-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--dc-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: var(--dc-space-md);
  border-radius: var(--dc-radius-md);
  font-size: var(--dc-font-size-sm);
  margin-bottom: var(--dc-space-md);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dc-auth-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--dc-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: var(--dc-space-md);
  border-radius: var(--dc-radius-md);
  font-size: var(--dc-font-size-sm);
  margin-bottom: var(--dc-space-md);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dc-auth-message {
  background: rgba(255, 255, 255, 0.8);
  color: var(--dc-gray-700);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: var(--dc-space-md);
  border-radius: var(--dc-radius-md);
  font-size: var(--dc-font-size-sm);
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Loading Spinner */
.dc-auth-loading {
  display: inline-flex;
  align-items: center;
  gap: var(--dc-space-sm);
}

.dc-auth-spinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid var(--dc-white);
  border-radius: 50%;
  animation: dc-auth-spin 1s linear infinite;
}

@keyframes dc-auth-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Form Layout */
.dc-auth-form-group {
  margin-bottom: var(--dc-space-lg);
}

.dc-auth-form-group:last-child {
  margin-bottom: 0;
}

.dc-auth-form-actions {
  display: flex;
  flex-direction: column;
  gap: var(--dc-space-md);
  align-items: center;
}

/* Footer */
.dc-auth-footer {
  text-align: center;
  border-top: 1px solid #dde3ee;
  padding-top: var(--dc-space-lg);
}

.dc-auth-help {
  font-size: var(--dc-font-size-sm);
  color: var(--dc-gray-600);
  margin: 0;
}

.dc-auth-help a {
  color: var(--dc-primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--dc-transition);
}

.dc-auth-help a:hover {
  color: var(--dc-primary-dark);
  text-decoration: underline;
}

/* Fallback Form Styles */
.dc-auth-fallback-form {
  width: 100%;
}

.dc-auth-fallback-form input[type="text"] {
  width: 100%;
  padding: var(--dc-space-md) var(--dc-space-lg);
  font-size: var(--dc-font-size-base);
  line-height: 1.5;
  color: var(--dc-gray-900);
  background-color: #f9fafc;
  border: 1px solid #dde3ee;
  border-radius: 12px;
  transition: var(--dc-transition);
  box-sizing: border-box;
  font-family: var(--dc-font-family);
  margin-bottom: var(--dc-space-md);
  
  /* Simple inset shadow like login form */
  box-shadow: inset 2px 2px 4px #DDE3EE, inset -2px -2px 4px #FFFFFF;
}

.dc-auth-fallback-form input[type="text"]:focus {
  outline: none;
  border-color: #4452ff;
  box-shadow: 
    inset 2px 2px 4px #DDE3EE, 
    inset -2px -2px 4px #FFFFFF,
    0 0 0 2px rgba(68, 82, 255, 0.2);
}

/* Logged-in State */
.dc-auth-logged-in .block {
  display: block;
  width: 100%;
  padding: var(--dc-space-lg);
  background-color: #f9fafc;
  border: none;
  border-radius: 12px;
  color: var(--dc-gray-900);
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  transition: var(--dc-transition);
  cursor: pointer;
  
  /* Same neumorphic shadow as login form */
  box-shadow: -4px -4px 8px #FFFFFF, 4px 4px 8px #DDE3EE !important;
  -webkit-box-shadow: -4px -4px 8px #FFFFFF, 4px 4px 8px #DDE3EE !important;
  -moz-box-shadow: -4px -4px 8px #FFFFFF, 4px 4px 8px #DDE3EE !important;
}

.dc-auth-logged-in .block:hover {
  opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
  body.dc-auth-page {
    background-size: auto 100%;
    background-position: center center;
  }
}

@media (max-width: 480px) {
  body.dc-auth-page {
    background-size: auto 120%;
    background-position: center top;
  }
  
  .dc-auth-container {
    padding: var(--dc-space-sm);
  }
  
  .dc-auth-card {
    padding: var(--dc-space-xl);
  }
  
  .dc-auth-main {
    /* Adjust negative margin for smaller logo on mobile */
    margin-top: -46px; /* (60px logo + 32px margin) / 2 = 46px */
  }
  
  .dc-auth-logo-image {
    width: 60px;
    height: 60px;
  }
  
  .dc-auth-title {
    font-size: var(--dc-font-size-2xl);
  }
  
  .dc-auth-input,
  .dc-auth-button,
  .dc-auth-fallback-form input[type="text"] {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: var(--dc-space-md);
  }
}

@media (max-width: 360px) {
  .dc-auth-card {
    padding: var(--dc-space-lg);
  }
  
  .dc-auth-header {
    margin-bottom: var(--dc-space-lg);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .dc-auth-card {
    background: var(--dc-white);
    border: 2px solid var(--dc-gray-900);
  }
  
  .dc-auth-input {
    background: var(--dc-white);
    border: 2px solid var(--dc-gray-900);
  }
  
  .dc-auth-button {
    background: var(--dc-gray-900);
    border: 2px solid var(--dc-gray-900);
  }
}


/* Loading Overlay */
.dc-auth-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #f9fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.dc-auth-loader.dc-auth-loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.dc-auth-loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: dc-loader-fade-in 0.3s ease-out;
}

.dc-auth-loader-icon {
  position: relative;
}

.dc-auth-loader-favicon {
  width: 48px;
  height: 48px;
  filter: grayscale(100%) opacity(0.5);
  animation: dc-loader-pulse 2s ease-in-out infinite;
}

@keyframes dc-loader-pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

@keyframes dc-loader-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .dc-auth-loader-favicon {
    animation: none;
    opacity: 0.5;
  }
}
