/**
 * @file
 * Styles for unified authentication page with smart detection.
 */

/* Reset body and admin theme styles for login page */
body.path-login,
body.unified-login-page {
  margin: 0 !important;
  padding: 0 !important;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
  min-height: 100vh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Hide admin toolbar on login page */
body.path-login .toolbar-oriented,
body.path-login #toolbar-administration {
  display: none !important;
}

/* Remove any admin theme padding/margins */
body.path-login .layout-container,
body.path-login .region-content,
body.path-login .block,
body.path-login .block-system-main-block,
body.path-login .block__content,
body.path-login [data-drupal-selector*="block"] {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.poymane-unified-login {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

/* Single panel container - enhanced design */
.login-container {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin: 0 auto;
}

/* Header section - Enhanced with dramatic visual impact */
.login-header {
  text-align: center;
  padding: 50px 30px 40px;
  background: linear-gradient(135deg, #4c63d2 0%, #6366f1 25%, #8b5cf6 75%, #a855f7 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.login-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

/* Hero logo - Make shepherd illustration prominent */
.hero-logo {
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
}

.shepherd-illustration,
.hero-logo .logo-image,
.hero-logo img {
  height: 120px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s ease;
}

.shepherd-illustration:hover,
.hero-logo .logo-image:hover,
.hero-logo img:hover {
  transform: scale(1.05);
}

/* Hero title - Typography drama */
.hero-title,
.login-header h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  letter-spacing: -0.5px;
  position: relative;
  z-index: 2;
}

.login-header p {
  font-size: 16px;
  margin: 0;
  opacity: 0.9;
  color: white;
}

/* Messages */
.login-messages {
  padding: 0 30px;
  margin-top: -10px;
}

.login-messages .messages {
  margin: 20px 0;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
}

/* Form wrapper - Premium card design */
.login-form-wrapper {
  padding: 0;
  position: relative;
}

.premium-card {
  background: #ffffff;
  position: relative;
}

.card-content {
  padding: 40px 30px 30px;
  position: relative;
  z-index: 1;
}

.card-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #e2e8f0 50%, transparent 100%);
}

/* Unified login hero logo enhancements */
.poymane-unified-login .hero-logo-shell {
  position: relative;
  display: inline-flex;
  padding: 20px;
}

.poymane-unified-login .hero-logo-frame {
  position: relative;
  z-index: 2;
}

.poymane-unified-login .hero-logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(99, 102, 241, 0.6) 0%, rgba(14, 165, 233, 0.35) 50%, transparent 80%),
    radial-gradient(circle, rgba(59, 130, 246, 0.5) 10%, rgba(14, 165, 233, 0.25) 55%, transparent 90%);
  filter: blur(35px);
  opacity: 0.7;
  transform: translate(-50%, -50%) scale(0.85);
  animation: heroLogoPulse 6s ease-in-out infinite;
  z-index: 1;
}

@keyframes heroLogoPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0.45;
  }
  50% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.85;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0.45;
  }
}

.form-title,
.login-form-wrapper h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 32px 0;
  color: #1e293b;
  text-align: center;
  letter-spacing: -0.3px;
}

.login-form-wrapper h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px 0;
  color: #333;
}

/* Enhanced Forms */
.enhanced-form {
  margin: 0;
}

.enhanced-input-group {
  margin-bottom: 24px;
  position: relative;
}

.form-label,
.enhanced-input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  letter-spacing: 0.1px;
}

/* Premium input wrapper with icon support */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.input-icon.visible {
  opacity: 0.6;
}

.input-icon svg {
  width: 100%;
  height: 100%;
  color: #6b7280;
}

/* Premium input styling */
.premium-input,
.form-control {
  width: 100%;
  padding: 16px 20px;
  padding-left: 48px; /* Space for icon */
  font-size: 16px;
  font-weight: 400;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  color: #1f2937;
  line-height: 1.5;
}

.premium-input:focus,
.form-control:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  background: #ffffff;
}

.premium-input:hover,
.form-control:hover {
  border-color: #d1d5db;
}

/* When input has no icon, reduce left padding */
.input-wrapper:not(.has-icon) .premium-input,
.input-wrapper:not(.has-icon) .form-control {
  padding-left: 20px;
}

.form-control.readonly-input {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.enhanced-help,
.help-text {
  display: block;
  font-size: 14px;
  color: #6b7280;
  margin-top: 8px;
  line-height: 1.4;
}

/* Password field with toggle */
.password-input-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: #333;
}

/* Premium Button Styles */
.premium-button,
.btn {
  display: inline-block;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  width: 100%;
  line-height: 1.5;
  letter-spacing: 0.2px;
}

.premium-button-section {
  margin-top: 8px;
}

.premium-button,
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.premium-button:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}

.btn-link {
  background: none;
  color: #667eea;
  padding: 8px 0;
  font-size: 14px;
  width: auto;
}

.btn-link:hover {
  color: #5a67d8;
  text-decoration: underline;
}

/* Premium Google OAuth Button */
.premium-oauth {
  margin-top: 20px;
}

.premium-google-btn,
.btn-google {
  background: #ffffff;
  color: #374151;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px 24px;
  border-radius: 12px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.premium-google-btn:hover,
.btn-google:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.google-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.google-note {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin: 0;
  font-weight: 400;
}

/* Spinner */
.btn-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn-login.loading .btn-text {
  visibility: hidden;
}

/* Form actions */
.form-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

/* Elegant divider */
.elegant-divider,
.login-divider {
  text-align: center;
  margin: 32px 0 24px;
  position: relative;
}

.elegant-divider span,
.login-divider span {
  background: white;
  padding: 0 20px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  z-index: 1;
  letter-spacing: 0.5px;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e0e0e0;
}

/* Password and OTP sections */
.password-section,
.otp-section {
  margin-top: 20px;
}

/* OTP input */
.otp-input {
  font-size: 24px;
  text-align: center;
  letter-spacing: 8px;
  font-family: monospace;
}

/* Footer */
.login-footer {
  text-align: center;
  padding: 20px 30px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

.login-footer p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

/* Resend button */
.resend-btn {
  margin-top: 12px;
}

.resend-timer {
  color: #999;
  font-weight: normal;
}

/* Mobile responsiveness - Enhanced */
@media (max-width: 480px) {
  .login-container {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin: 12px;
  }
  
  .poymane-unified-login {
    padding: 12px;
  }
  
  .login-header {
    padding: 32px 20px 24px;
  }
  
  .hero-title,
  .login-header h1 {
    font-size: 24px;
  }
  
  .shepherd-illustration,
  .hero-logo .logo-image,
  .hero-logo img {
    height: 80px;
  }
  
  .card-content {
    padding: 24px 20px 20px;
  }
  
  .form-title {
    font-size: 20px;
    margin-bottom: 24px;
  }
  
  .premium-input,
  .form-control {
    padding: 14px 18px;
    padding-left: 44px;
  }
  
  .input-icon {
    left: 14px;
    width: 18px;
    height: 18px;
  }
  
  .login-footer {
    padding: 20px;
  }
}

/* Tablet adjustments - Enhanced */
@media (min-width: 481px) and (max-width: 768px) {
  .login-container {
    max-width: 420px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  }
  
  .login-header {
    padding: 40px 24px 32px;
  }
  
  .hero-title,
  .login-header h1 {
    font-size: 28px;
  }
  
  .shepherd-illustration,
  .hero-logo .logo-image,
  .hero-logo img {
    height: 100px;
  }
  
  .card-content {
    padding: 32px 24px 24px;
  }
}
