/**
 * Enhanced Footer Styles
 * Contemporary, responsive, and accessible footer design
 * WCAG 2.1 AA compliant with semantic HTML5 structure
 */

/* Footer Container */
.footer-enhanced {
  background: linear-gradient(135deg, var(--base-200, #f9fafb) 0%, var(--base-300, #f3f4f6) 100%);
  border-top: 1px solid var(--base-300, #e5e7eb);
  position: relative;
  overflow: hidden;
}

.footer-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary, #2563eb), transparent);
  opacity: 0.3;
}

/* Skip Link for Accessibility */
.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;
}

.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Footer Grid Layout */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 3rem;
  }
}

/* Footer Sections */
.footer-section {
  position: relative;
}

.footer-section::after {
  content: '';
  position: absolute;
  bottom: -1rem;
  left: 0;
  width: 2rem;
  height: 2px;
  background: linear-gradient(90deg, var(--primary, #2563eb), transparent);
  opacity: 0.6;
}

/* Brand Section */
.brand-container {
  margin-bottom: 1rem;
}

.brand-logo {
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.brand-logo:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.brand-name {
  background: linear-gradient(135deg, var(--primary, #2563eb), var(--primary-dark, #475569));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity 0.3s ease;
}

.brand-name:hover {
  opacity: 0.8;
}

/* Company Description */
.company-description {
  color: var(--neutral, #6b7280);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

/* Social Navigation */
.social-nav {
  margin-top: 1rem;
}

.social-links {
  display: flex;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(var(--primary-rgb, 37, 116, 240), 0.1);
  border: 1px solid rgba(var(--primary-rgb, 37, 116, 240), 0.2);
  border-radius: 50%;
  color: var(--primary, #2563eb);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.social-link:hover::before {
  left: 100%;
}

.social-link:hover {
  background: var(--primary, #2563eb);
  color: white;
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 8px 25px rgba(var(--primary-rgb, 37, 116, 240), 0.3);
}

.social-link:focus {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  transform: scale(1.1);
}

.social-link:active {
  transform: scale(0.95);
}

/* Footer Navigation */
.footer-nav {
  position: relative;
}

.footer-heading {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--neutral, #374151);
  margin-bottom: 1.5rem;
  font-family: var(--font-heading, 'Outfit', sans-serif);
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-heading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2rem;
  height: 2px;
  background: linear-gradient(90deg, var(--primary, #2563eb), transparent);
  border-radius: 1px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--neutral, #6b7280);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.footer-link::before {
  content: '';
  position: absolute;
  left: -100%;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(var(--primary-rgb, 37, 116, 240), 0.05);
  transition: left 0.3s ease;
  border-radius: 0.375rem;
}

.footer-link:hover::before {
  left: 0;
}

.footer-link:hover {
  color: var(--primary, #2563eb);
  transform: translateX(0.25rem);
}

.footer-link:focus {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  background: rgba(var(--primary-rgb, 37, 116, 240), 0.05);
}

.footer-link:active {
  transform: translateX(0.125rem) scale(0.98);
}

.link-icon {
  font-size: 0.75rem;
  color: var(--primary, #2563eb);
  transition: transform 0.3s ease;
  width: 1rem;
  text-align: center;
}

.footer-link:hover .link-icon {
  transform: scale(1.2);
}

/* Contact Information */
.contact-details {
  font-style: normal;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.contact-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(var(--primary-rgb, 37, 116, 240), 0.03);
  transition: left 0.3s ease;
}

.contact-item:hover::before {
  left: 0;
}

.contact-item:hover {
  background: rgba(var(--primary-rgb, 37, 116, 240), 0.05);
  transform: translateX(0.25rem);
}

.contact-icon {
  color: var(--primary, #2563eb);
  font-size: 1rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}

.contact-content {
  flex: 1;
  min-width: 0;
}

.contact-link {
  color: var(--neutral, #6b7280);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.3s ease;
  display: block;
  line-height: 1.5;
}

.contact-link:hover {
  color: var(--primary, #2563eb);
}

.contact-link:focus {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.contact-text {
  color: var(--neutral, #6b7280);
  line-height: 1.5;
  display: block;
}

/* Newsletter Section */
.newsletter-section {
  border-top: 1px solid var(--base-300, #e5e7eb);
  padding-top: 2rem;
  margin-top: 2rem;
}

.newsletter-container {
  max-width: 32rem;
  margin: 0 auto;
  text-align: center;
}

.newsletter-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--neutral, #374151);
  margin-bottom: 0.75rem;
  font-family: var(--font-heading, 'Outfit', sans-serif);
}

.newsletter-description {
  color: var(--neutral, #6b7280);
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-size: 0.875rem;
}

.newsletter-form {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  max-width: 100%;
}

@media (max-width: 640px) {
  .newsletter-form {
    flex-direction: column;
  }
}

.form-group {
  flex: 1;
  position: relative;
}

.newsletter-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--base-300, #e5e7eb);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: white;
  transition: all 0.3s ease;
  color: var(--neutral, #374151);
}

.newsletter-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 37, 116, 240), 0.1);
}

.newsletter-input::placeholder {
  color: var(--neutral, #9ca3af);
}

.newsletter-input[aria-invalid="true"] {
  border-color: var(--danger, #ef4444);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.newsletter-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary, #2563eb);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  min-width: 7rem;
  justify-content: center;
}

.newsletter-button:hover:not(:disabled) {
  background: var(--primary-dark, #475569);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb, 37, 116, 240), 0.3);
}

.newsletter-button:focus {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.newsletter-button:active {
  transform: translateY(0);
}

.newsletter-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.button-icon {
  font-size: 0.875rem;
}

/* Email Error Styling */
.email-error {
  color: var(--danger, #ef4444);
  font-size: 0.75rem;
  margin-top: 0.5rem;
  display: none;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  background: rgba(239, 68, 68, 0.05);
  border-radius: 0.375rem;
  border-left: 3px solid var(--danger, #ef4444);
}

/* Footer Bottom Bar */
.footer-bottom {
  background: var(--base-300, #f3f4f6);
  border-top: 1px solid var(--base-300, #e5e7eb);
  padding: 1.5rem 0;
}

.bottom-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .bottom-bar {
    flex-direction: row;
  }
}

.copyright-section {
  flex: 1;
  text-align: center;
}

@media (min-width: 768px) {
  .copyright-section {
    text-align: left;
  }
}

.copyright-text {
  color: var(--neutral, #6b7280);
  font-size: 0.875rem;
  margin: 0;
}

.company-name {
  font-weight: 600;
  color: var(--primary, #2563eb);
}

/* Legal Navigation */
.legal-nav {
  flex: 1;
  text-align: center;
}

.legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.legal-link {
  color: var(--neutral, #6b7280);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.3s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.legal-link:hover {
  color: var(--primary, #2563eb);
}

.legal-link:focus {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.separator {
  color: var(--neutral, #9ca3af);
  font-size: 0.875rem;
}

/* Back to Top Button */
.back-to-top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary, #2563eb);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb, 37, 116, 240), 0.2);
}

.back-to-top:hover {
  background: var(--primary-dark, #475569);
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 4px 16px rgba(var(--primary-rgb, 37, 116, 240), 0.3);
}

.back-to-top:focus {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  transform: scale(1.1);
}

.back-to-top:active {
  transform: translateY(0) scale(0.95);
}

/* Dark Mode Support */
[data-theme="dark"] .footer-enhanced {
  background: linear-gradient(135deg, var(--base-200, #0a0a0a) 0%, var(--base-300, #171717) 100%);
  border-top-color: var(--base-300, #374151);
}

[data-theme="dark"] .footer-enhanced::before {
  background: linear-gradient(90deg, transparent, var(--primary, #60a5fa), transparent);
}

[data-theme="dark"] .company-description,
[data-theme="dark"] .footer-heading,
[data-theme="dark"] .footer-link,
[data-theme="dark"] .contact-link,
[data-theme="dark"] .contact-text,
[data-theme="dark"] .copyright-text,
[data-theme="dark"] .legal-link {
  color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .newsletter-input {
  background: var(--base-100, #1f2937);
  border-color: var(--base-300, #374151);
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .newsletter-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .footer-bottom {
  background: var(--base-300, #171717);
  border-top-color: var(--base-300, #374151);
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .social-link:hover,
  .footer-link:hover,
  .back-to-top:hover {
    transform: none !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .footer-enhanced {
    border-top-width: 2px;
  }
  
  .social-link {
    border-width: 2px;
  }
  
  .footer-link,
  .contact-link,
  .legal-link {
    border-radius: 0;
  }
}

/* Print Styles */
@media print {
  .footer-enhanced {
    background: white !important;
    color: black !important;
    border-top: 1px solid #ccc !important;
  }
  
  .social-link,
  .back-to-top {
    display: none !important;
  }
  
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }
  
  .newsletter-section {
    display: none !important;
  }
}

/* Focus Visible Support */
@supports selector(:focus-visible) {
  .social-link:focus:not(:focus-visible),
  .footer-link:focus:not(:focus-visible),
  .contact-link:focus:not(:focus-visible),
  .legal-link:focus:not(:focus-visible),
  .newsletter-button:focus:not(:focus-visible),
  .back-to-top:focus:not(:focus-visible) {
    outline: none;
  }
}

/* Loading State for Newsletter */
.newsletter-button .fa-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Typography */
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .newsletter-title {
    font-size: 1.25rem;
  }
  
  .footer-heading {
    font-size: 1rem;
  }
  
  .social-links {
    justify-content: center;
  }
  
  .legal-links {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .separator {
    display: none;
  }
}

/* Enhanced Visual Hierarchy */
.footer-section:nth-child(1) { /* Company Info */ }
.footer-section:nth-child(2) { /* Quick Links */ }
.footer-section:nth-child(3) { /* Legal */ }
.footer-section:nth-child(4) { /* Contact */ }

/* Subtle Animations on Scroll */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.footer-section {
  animation: fadeInUp 0.6s ease-out forwards;
}

.footer-section:nth-child(1) { animation-delay: 0.1s; }
.footer-section:nth-child(2) { animation-delay: 0.2s; }
.footer-section:nth-child(3) { animation-delay: 0.3s; }
.footer-section:nth-child(4) { animation-delay: 0.4s; }

/* Reduced motion support for animations */
@media (prefers-reduced-motion: reduce) {
  .footer-section {
    animation: none;
  }
}