/**
 * ATC Checkout Floating Timer
 */

.atc-checkout-timer {
  position: fixed;
  top: 18px;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  z-index: 999999;
  pointer-events: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  animation: atcTimerSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  width: 50%;
  max-width: 440px;
  min-width: 290px;
  box-sizing: border-box;
}

body.admin-bar .atc-checkout-timer {
  top: 50px;
}

.atc-checkout-timer__container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  box-shadow:
    0 10px 30px -5px rgba(15, 23, 42, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 24px -4px rgba(30, 52, 137, 0.35);
  transition: all 0.3s ease;
}

.atc-checkout-timer__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  flex-shrink: 0;
  animation: atcTimerGlow 2.5s ease-in-out infinite;
}

.atc-checkout-timer__body {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  min-width: 0;
}

.atc-checkout-timer__label {
  font-size: 12.5px;
  font-weight: 500;
  color: #cbd5e1;
  letter-spacing: -0.01em;
}

.atc-timer-label-full {
  display: inline;
}

.atc-timer-label-short {
  display: none;
}

.atc-checkout-timer__clock {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.atc-checkout-timer__segment {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}

.atc-checkout-timer__digits {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.atc-checkout-timer__unit {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
}

.atc-checkout-timer__separator {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  margin: 0 1px;
  animation: atcColonBlink 1s ease-in-out infinite;
  line-height: 1;
}

/* Urgent state when less than 2 minutes remain */
.atc-checkout-timer--urgent .atc-checkout-timer__container {
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow:
    0 10px 30px -5px rgba(244, 63, 94, 0.25),
    0 0 24px -4px rgba(244, 63, 94, 0.2);
}

.atc-checkout-timer--urgent .atc-checkout-timer__icon {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.atc-checkout-timer--urgent .atc-checkout-timer__digits {
  color: #fda4af;
}

/* Expired state when timer reaches 00:00 */
.atc-checkout-timer--expired .atc-checkout-timer__container {
  background: rgba(24, 10, 16, 0.95);
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow:
    0 10px 30px -5px rgba(239, 68, 68, 0.35),
    0 0 0 1px rgba(239, 68, 68, 0.25),
    0 0 24px -4px rgba(239, 68, 68, 0.3);
}

.atc-checkout-timer--expired .atc-checkout-timer__icon {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  animation: none;
}

.atc-checkout-timer--expired .atc-checkout-timer__clock {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
}

.atc-checkout-timer--expired .atc-checkout-timer__digits {
  color: #ef4444;
  font-weight: 800;
}

.atc-checkout-timer--expired .atc-checkout-timer__separator {
  color: #ef4444;
  animation: none;
  opacity: 1;
}

.atc-checkout-timer--expired .atc-checkout-timer__unit {
  color: #f87171;
}

/* Animations */
@keyframes atcTimerSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes atcTimerSlideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes atcTimerGlow {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.85;
  }
}

@keyframes atcColonBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* Responsive adjustments */
@media (max-width: 782px) {
  body.admin-bar .atc-checkout-timer {
    top: 58px;
  }
}

@media (max-width: 640px) {
  .atc-checkout-timer {
    top: 12px;
    bottom: auto;
    width: auto;
    max-width: 92%;
    min-width: 260px;
  }

  .atc-checkout-timer__container {
    padding: 7px 12px;
    gap: 6px;
  }

  .atc-timer-label-full {
    display: none;
  }

  .atc-timer-label-short {
    display: inline;
  }

  .atc-checkout-timer__label {
    font-size: 11.5px;
  }

  .atc-checkout-timer__digits {
    font-size: 13px;
  }
}
