/**
 * Footer Component
 * Full accessibility support
 * Footer block for secondary information and navigation
 */

/* ========================================
   FOOTER CUSTOM PROPERTIES
   ======================================== */

.c-footer {
  /* Base properties */
  --c-footer-background: var(--ds-color-surface);
  --c-footer-border-color: var(--ds-color-border);
  --c-footer-text-color: var(--ds-color-text);
  --c-footer-text-weak-color: var(--ds-color-text-weak);
  --c-footer-padding-block: var(--ds-space-l);
  --c-footer-padding-inline: var(--ds-space-l);
  --c-footer-gap: var(--ds-space-m);
  
  /* Shadow */
  --c-footer-shadow: var(--ds-shadow-s);
  
  /* Typography */
  --c-footer-text-font-size: var(--ds-font-size-s);
  --c-footer-text-line-height: var(--ds-line-height-m);
  --c-footer-link-color: var(--ds-color-text);
  --c-footer-link-hover-color: var(--ds-color-primary);
  
  /* Transitions */
  --c-footer-transition: background-color var(--ds-duration-fast) var(--ds-ease-out),
                         border-color var(--ds-duration-fast) var(--ds-ease-out),
                         box-shadow var(--ds-duration-fast) var(--ds-ease-out);
}

/* ========================================
   BASE FOOTER STYLES
   ======================================== */

.c-footer {
  display: flex;
  flex-direction: column;
  padding: var(--c-footer-padding-block) var(--c-footer-padding-inline);
  background: var(--c-footer-background);
  border-top: 1px solid var(--c-footer-border-color);
  color: var(--c-footer-text-color);
  font-size: var(--c-footer-text-font-size);
  line-height: var(--c-footer-text-line-height);
  gap: var(--c-footer-gap);
  transition: var(--c-footer-transition);
}

/* Footer main content area */
.c-footer__content {
  display: flex;
  flex-wrap: wrap;
  gap: var(--c-footer-gap);
  align-items: flex-start;
}

/* Footer section */
.c-footer__section {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-s);
}

.c-footer__section-title {
  margin: 0 0 var(--ds-space-s) 0;
  font-size: var(--ds-font-size-m);
  font-weight: var(--ds-font-weight-semibold);
  color: var(--c-footer-text-color);
}

/* Footer navigation */
.c-footer__nav {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-xs);
}

.c-footer__nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-xs);
}

.c-footer__nav-item {
  margin: 0;
}

.c-footer__nav-link {
  color: var(--c-footer-link-color);
  text-decoration: none;
  transition: color var(--ds-duration-fast) var(--ds-ease-out);
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-xs);
}

.c-footer__nav-link:hover,
.c-footer__nav-link:focus {
  color: var(--c-footer-link-hover-color);
  text-decoration: underline;
}

.c-footer__nav-link:focus {
  outline: 2px solid var(--ds-color-border-focus);
  outline-offset: 2px;
  border-radius: var(--ds-radius-xs);
}

/* Footer bottom area */
.c-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ds-space-s);
  padding-top: var(--c-footer-gap);
  border-top: 1px solid var(--c-footer-border-color);
  color: var(--c-footer-text-weak-color);
}

/* Footer copyright */
.c-footer__copyright {
  margin: 0;
  font-size: var(--ds-font-size-xs);
}

/* Footer social links */
.c-footer__social {
  display: flex;
  gap: var(--ds-space-s);
  align-items: center;
}

.c-footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--c-footer-text-weak-color);
  text-decoration: none;
  border-radius: var(--ds-radius-s);
  transition: var(--c-footer-transition);
}

.c-footer__social-link:hover,
.c-footer__social-link:focus {
  color: var(--c-footer-link-hover-color);
  background: var(--ds-color-surface-hover);
}

.c-footer__social-link:focus {
  outline: 2px solid var(--ds-color-border-focus);
  outline-offset: 2px;
}

.c-footer__social-link .c-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* ========================================
   SIZE VARIANTS
   ======================================== */

/* Small footer */
.c-footer--size-s {
  --c-footer-padding-block: var(--ds-space-m);
  --c-footer-padding-inline: var(--ds-space-m);
  --c-footer-gap: var(--ds-space-s);
}

.c-footer--size-s .c-footer__section {
  min-width: 150px;
}

.c-footer--size-s .c-footer__social-link {
  width: 1.75rem;
  height: 1.75rem;
}

.c-footer--size-s .c-footer__social-link .c-icon {
  width: 1rem;
  height: 1rem;
}

/* Large footer */
.c-footer--size-l {
  --c-footer-padding-block: var(--ds-space-xl);
  --c-footer-padding-inline: var(--ds-space-xl);
  --c-footer-gap: var(--ds-space-l);
}

.c-footer--size-l .c-footer__section {
  min-width: 250px;
}

.c-footer--size-l .c-footer__social-link {
  width: 2.5rem;
  height: 2.5rem;
}

.c-footer--size-l .c-footer__social-link .c-icon {
  width: 1.5rem;
  height: 1.5rem;
}

/* ========================================
   LAYOUT VARIANTS
   ======================================== */

/* Centered footer */
.c-footer--centered {
  text-align: center;
}

.c-footer--centered .c-footer__content {
  justify-content: center;
}

.c-footer--centered .c-footer__bottom {
  justify-content: center;
}

.c-footer--centered .c-footer__nav-list {
  align-items: center;
}

/* Horizontal footer (single row) */
.c-footer--horizontal .c-footer__content {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.c-footer--horizontal .c-footer__section {
  flex: none;
  min-width: auto;
}

.c-footer--horizontal .c-footer__nav-list {
  flex-direction: row;
  gap: var(--ds-space-m);
}

/* Minimal footer */
.c-footer--minimal {
  --c-footer-padding-block: var(--ds-space-m);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.c-footer--minimal .c-footer__content {
  flex: 1;
}

.c-footer--minimal .c-footer__bottom {
  border-top: none;
  padding-top: 0;
}

/* Borderless footer */
.c-footer--borderless {
  border-top: none;
}

/* Elevated footer (with shadow) */
.c-footer--elevated {
  box-shadow: 0 -1px 3px var(--ds-color-shadow);
}

/* Sticky footer */
.c-footer--sticky {
  position: sticky;
  bottom: 0;
  z-index: var(--ds-z-header);
  box-shadow: 0 -1px 3px var(--ds-color-shadow);
}

/* ========================================
   COLOR VARIANTS
   ======================================== */

/* Primary footer */
.c-footer--primary {
  --c-footer-background: var(--ds-color-primary);
  --c-footer-border-color: var(--ds-color-primary-strong);
  --c-footer-text-color: var(--ds-color-text-on-primary);
  --c-footer-text-weak-color: rgba(255, 255, 255, 0.7);
  --c-footer-link-color: var(--ds-color-text-on-primary);
  --c-footer-link-hover-color: rgba(255, 255, 255, 0.9);
}

/* Dark footer */
.c-footer--dark {
  --c-footer-background: var(--ds-color-surface-strong);
  --c-footer-border-color: var(--ds-color-border-strong);
  --c-footer-text-color: var(--ds-color-text-on-dark);
  --c-footer-text-weak-color: rgba(255, 255, 255, 0.6);
  --c-footer-link-color: var(--ds-color-text-on-dark);
  --c-footer-link-hover-color: rgba(255, 255, 255, 0.9);
}

/* Light footer */
.c-footer--light {
  --c-footer-background: var(--ds-color-surface-weak);
  --c-footer-border-color: var(--ds-color-border-weak);
  --c-footer-text-color: var(--ds-color-text);
  --c-footer-text-weak-color: var(--ds-color-text-weak);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet breakpoint */
@media (max-width: 1024px) {
  .c-footer {
    --c-footer-padding-inline: var(--ds-space-m);
    --c-footer-gap: var(--ds-space-s);
  }
  
  .c-footer__section {
    min-width: 180px;
  }
  
  .c-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--ds-space-m);
  }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
  .c-footer {
    --c-footer-padding-inline: var(--ds-space-s);
    --c-footer-padding-block: var(--ds-space-m);
  }
  
  .c-footer__content {
    flex-direction: column;
  }
  
  .c-footer__section {
    min-width: auto;
    width: 100%;
  }
  
  .c-footer__bottom {
    text-align: center;
    align-items: center;
  }
  
  /* Stack horizontal footer on mobile */
  .c-footer--horizontal .c-footer__content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .c-footer--horizontal .c-footer__nav-list {
    flex-direction: column;
    gap: var(--ds-space-s);
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .c-footer {
    --c-footer-padding-inline: var(--ds-space-xs);
  }
  
  .c-footer__social {
    justify-content: center;
    width: 100%;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .c-footer {
    background: transparent !important;
    border-top: 1px solid #000 !important;
    box-shadow: none !important;
    color: #000 !important;
  }
  
  .c-footer__social {
    display: none !important;
  }
  
  .c-footer__nav-link {
    color: #000 !important;
    text-decoration: none !important;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus management */
.c-footer:focus-within {
  outline: none;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .c-footer {
    border-top-width: 2px;
  }
  
  .c-footer--elevated {
    border: 2px solid;
  }
  
  .c-footer__nav-link {
    text-decoration: underline;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .c-footer,
  .c-footer *,
  .c-footer *::before,
  .c-footer *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   INTEGRATION WITH LAYOUT
   ======================================== */

/* When used in layout system */
.l-layout .c-footer {
  border-top: none; /* Layout handles borders */
}

.l-layout--sticky-footer .c-footer {
  position: sticky;
  bottom: 0;
  z-index: var(--ds-z-header);
  box-shadow: 0 -1px 3px var(--ds-color-shadow);
}

/* ========================================
   UTILITIES
   ======================================== */

/* Footer with loading state */
.c-footer--loading {
  position: relative;
  overflow: hidden;
}

.c-footer--loading::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--ds-color-primary),
    transparent
  );
  animation: footer-loading 1.5s infinite;
}

@keyframes footer-loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Footer with badge */
.c-footer__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-xs);
  padding: var(--ds-space-xs) var(--ds-space-s);
  background: var(--ds-color-surface-hover);
  border-radius: var(--ds-radius-s);
  font-size: var(--ds-font-size-xs);
  color: var(--ds-color-text-weak);
}
