/**
 * SuperBar Pro Public Styles
 * Lightweight, performant, accessible
 */

/* Container */
.superbar-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* No-JS fallback: show banners if JS hasn't run */
.superbar-banner:not(.superbar-visible):not(.superbar-closing) {
  /* Allow 1 second for JS to load, then show anyway */
}

/* After JS runs, it will add superbar-visible class */

.superbar-container--top-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
}

.superbar-container--bottom-sticky {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
}

.superbar-container--top-static {
  position: relative;
  z-index: 9999;
}

/* Banner Base */
.superbar-banner {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* Animation: None - no animation, show immediately */
.superbar-animation--none {
  opacity: 1;
  transform: none;
}

/* Animation: Slide Down */
.superbar-animation--slide-down {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.superbar-animation--slide-down.superbar-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Animation: Fade */
.superbar-animation--fade {
  opacity: 0;
  transform: none;
  transition: opacity 0.3s ease;
}

.superbar-animation--fade.superbar-visible {
  opacity: 1;
}

/* Banner hidden state */
.superbar-banner.superbar-closing {
  opacity: 0 !important;
  pointer-events: none;
}

.superbar-banner--hidden {
  display: none !important;
}

/* Bottom banners animate up */
.superbar-position--bottom-sticky {
  transform: translateY(20px);
}

.superbar-position--bottom-sticky.superbar-visible {
  transform: translateY(0);
}

.superbar-position--bottom-sticky.superbar-closing {
  transform: translateY(20px);
}

/* Inner Container */
.superbar-banner__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px;
  flex-wrap: wrap;
  position: relative;
}

/* Content */
.superbar-banner__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  text-align: center;
}

.superbar-banner__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.superbar-banner__text {
  line-height: 1.4;
}

.superbar-banner__text strong {
  font-weight: 700;
}

/* Links */
.superbar-banner__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  transition: opacity 0.2s;
}

.superbar-banner__link:hover {
  opacity: 0.8;
}

.superbar-banner__link svg {
  flex-shrink: 0;
}

/* CTA Button */
.superbar-banner__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.superbar-banner__cta:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Close Button */
.superbar-banner__close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 6px;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.superbar-banner__close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.superbar-banner__close:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Coupon Code */
.superbar-banner__coupon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.superbar-coupon-code {
  background: rgba(0, 0, 0, 0.15);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.9em;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.superbar-copy-btn {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
}

.superbar-copy-btn:hover {
  opacity: 1;
}

.superbar-copy-btn.copied {
  color: #10b981;
}

/* Countdown Timer */
.superbar-countdown {
  display: flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.superbar-countdown__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
}

.superbar-countdown__value {
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1;
  background: rgba(0, 0, 0, 0.15);
  padding: 4px 8px;
  border-radius: 4px;
}

.superbar-countdown__label {
  font-size: 0.65em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-top: 2px;
}

.superbar-countdown__separator {
  font-weight: 700;
  opacity: 0.5;
  align-self: flex-start;
  margin-top: 4px;
}

/* Free Shipping Progress */
.superbar-shipping {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
}

.superbar-shipping__text {
  flex-shrink: 0;
  white-space: nowrap;
}

.superbar-shipping__text--achieved {
  font-weight: 600;
}

.superbar-shipping__progress {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  overflow: hidden;
  min-width: 100px;
}

.superbar-shipping__bar {
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Newsletter Form */
.superbar-newsletter {
  display: flex;
  align-items: center;
}

.superbar-newsletter__field {
  display: flex;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.superbar-newsletter__input {
  padding: 8px 14px;
  border: none;
  font-size: 14px;
  min-width: 200px;
  outline: none;
}

.superbar-newsletter__input::placeholder {
  color: #9ca3af;
}

.superbar-newsletter__submit {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.superbar-newsletter__submit:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Animations - Bounce */
.superbar-animation--bounce {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.superbar-animation--bounce.superbar-visible {
  opacity: 1;
  transform: translateY(0);
  animation: superbar-bounce 0.5s ease 0.3s;
}

@keyframes superbar-bounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-8px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-4px); }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .superbar-banner,
  .superbar-banner__close,
  .superbar-banner__cta,
  .superbar-shipping__bar {
    transition: none;
  }
  
  .superbar-animation--bounce.superbar-visible {
    animation: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .superbar-banner__inner {
    padding: 0 44px 0 12px;
    gap: 8px;
  }
  
  .superbar-banner__content {
    gap: 8px;
    font-size: 0.9em;
  }
  
  .superbar-countdown__item {
    min-width: 32px;
  }
  
  .superbar-countdown__value {
    font-size: 1em;
    padding: 3px 6px;
  }
  
  .superbar-shipping {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .superbar-shipping__progress {
    width: 100%;
  }
  
  .superbar-newsletter__field {
    flex-direction: column;
    width: 100%;
  }
  
  .superbar-newsletter__input {
    min-width: auto;
    width: 100%;
  }
}

/* Print */
@media print {
  .superbar-container {
    display: none !important;
  }
}

/* High Contrast Mode */
@media (forced-colors: active) {
  .superbar-banner {
    border: 2px solid currentColor;
  }
  
  .superbar-banner__close {
    border: 1px solid currentColor;
  }
}
