/**
 * Smart Offers - Frontend CSS
 * RTL-first, responsive, modern design
 */

/* ============================================================
   BASE & RTL
   ============================================================ */
[class*="amcod-so-"] {
  direction: rtl;
  font-family: "Cairo", "Segoe UI", sans-serif;
  box-sizing: border-box;
  line-height: 1.6;
}

/* ============================================================
   MODAL POPUP
   ============================================================ */
.amcod-so-popup-modal,
.amcod-so-popup-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.amcod-so-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  backdrop-filter: blur(4px);
}

.amcod-so-modal-box {
  position: relative;
  z-index: 2;
  max-width: 480px;
  width: 90%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.amcod-so-popup-image img {
  width: 100%;
  height: auto;
  display: block;
}

.amcod-so-popup-body {
  padding: 24px 28px;
  text-align: center;
}

.amcod-so-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
}

.amcod-so-message {
  font-size: 15px;
  margin: 0 0 20px;
  opacity: 0.85;
}

.amcod-so-close {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  transition: all 0.2s;
  z-index: 10;
}

.amcod-so-close:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
}

/* CTA Button */
.amcod-so-cta-btn {
  display: inline-block;
  padding: 12px 32px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
}

.amcod-so-cta-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.amcod-so-cta-large {
  padding: 16px 48px;
  font-size: 20px;
  border-radius: 14px;
}

.amcod-so-dismiss {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.amcod-so-dismiss:hover {
  opacity: 0.8;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.amcod-so-popup-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999998;
  padding: 12px 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.amcod-so-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.amcod-so-topbar-title {
  font-weight: 700;
  font-size: 15px;
}

.amcod-so-topbar-message {
  font-size: 14px;
}

.amcod-so-topbar-cta {
  padding: 6px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s;
  white-space: nowrap;
}

.amcod-so-topbar-close {
  position: static;
  width: 28px;
  height: 28px;
  font-size: 16px;
  margin-right: auto;
}

/* ============================================================
   BOTTOM BAR
   ============================================================ */
.amcod-so-popup-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999998;
  padding: 14px 20px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
}

.amcod-so-bottombar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.amcod-so-bottombar-title {
  font-weight: 700;
}

.amcod-so-bottombar-cta {
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s;
}

.amcod-so-bottombar-close {
  position: static;
  margin-right: auto;
}

/* ============================================================
   SLIDE-IN
   ============================================================ */
.amcod-so-popup-slidein {
  position: fixed;
  bottom: 20px;
  z-index: 999997;
  width: 340px;
  max-width: 90vw;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.amcod-so-slide-right {
  right: 20px;
}
.amcod-so-slide-left {
  left: 20px;
}

.amcod-so-slidein-image img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 12px;
}

.amcod-so-popup-slidein .amcod-so-close {
  top: 8px;
  left: 8px;
}

.amcod-so-popup-slidein .amcod-so-title {
  font-size: 18px;
  margin-bottom: 8px;
}

.amcod-so-popup-slidein .amcod-so-message {
  font-size: 14px;
  margin-bottom: 14px;
}

.amcod-so-popup-slidein .amcod-so-cta-btn {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: 14px;
}

/* ============================================================
   FULLSCREEN
   ============================================================ */
.amcod-so-fullscreen-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
  padding: 40px;
}

.amcod-so-fullscreen-content .amcod-so-title {
  font-size: 32px;
  margin-bottom: 16px;
}

.amcod-so-fullscreen-content .amcod-so-message {
  font-size: 18px;
  margin-bottom: 24px;
}

.amcod-so-fullscreen-image img {
  max-width: 300px;
  border-radius: 16px;
  margin-bottom: 20px;
}

.amcod-so-fullscreen-close {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 40px;
  height: 40px;
  font-size: 24px;
}

/* ============================================================
   COUNTDOWN TIMER
   ============================================================ */
.amcod-so-countdown-wrap {
  padding: 14px 20px;
  border-radius: 12px;
  margin: 12px 0;
  text-align: center;
}

.amcod-so-countdown-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.amcod-so-countdown-digits {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.amcod-so-cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}

.amcod-so-cd-num {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.08);
  padding: 4px 10px;
  border-radius: 8px;
  line-height: 1.2;
}

.amcod-so-cd-label {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

.amcod-so-cd-sep {
  font-size: 24px;
  font-weight: 800;
  opacity: 0.5;
  margin-top: -14px;
}

/* ============================================================
   PROGRESS BAR (Shipping)
   ============================================================ */
.amcod-so-progress-wrap {
  padding: 14px 20px;
  border-radius: 12px;
  margin: 12px 0;
}

.amcod-so-progress-text {
  font-size: 14px;
  text-align: center;
  margin-bottom: 10px;
}

.amcod-so-progress-bar-track {
  height: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.amcod-so-progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.amcod-so-progress-bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: amcod-so-shimmer 2s infinite;
}

@keyframes amcod-so-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.amcod-so-progress-complete .amcod-so-progress-bar-fill::after {
  animation: none;
}

/* ============================================================
   STOCK ALERT & VIEWERS
   ============================================================ */
.amcod-so-stock-alert,
.amcod-so-viewers-alert {
  padding: 10px 16px;
  border-radius: 10px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.amcod-so-viewers-dot {
  width: 10px;
  height: 10px;
  background: #27ae60;
  border-radius: 50%;
  animation: amcod-so-pulse 1.5s infinite;
  flex-shrink: 0;
}

@keyframes amcod-so-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ============================================================
   DISCOUNT BADGE
   ============================================================ */
.amcod-so-discount-badge {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
.amcod-so-anim-fadeIn {
  animation: amcod-so-fadeInUp 0.4s ease-out;
}

.amcod-so-anim-slideIn {
  animation: amcod-so-slideInRight 0.4s ease-out;
}

@keyframes amcod-so-fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes amcod-so-slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================================
   TEMPLATE VARIANTS
   ============================================================ */
/* Gradient template */
.amcod-so-template-gradient .amcod-so-modal-box {
  background: linear-gradient(
    135deg,
    var(--bg-color, #654ad1),
    var(--accent, #8e44ad)
  ) !important;
  color: #fff !important;
}

.amcod-so-template-gradient .amcod-so-cta-btn {
  background: rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(10px);
}

/* Bold template */
.amcod-so-template-bold .amcod-so-title {
  font-size: 28px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Elegant template */
.amcod-so-template-elegant .amcod-so-modal-box {
  border: 2px solid rgba(0, 0, 0, 0.08);
}

.amcod-so-template-elegant .amcod-so-cta-btn {
  border-radius: 50px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .amcod-so-modal-box {
    width: 95%;
    max-width: none;
    border-radius: 12px;
  }

  .amcod-so-popup-body {
    padding: 18px 20px;
  }

  .amcod-so-title {
    font-size: 18px;
  }

  .amcod-so-popup-slidein {
    width: calc(100vw - 20px);
    right: 10px !important;
    left: 10px !important;
    bottom: 10px;
  }

  .amcod-so-topbar-inner,
  .amcod-so-bottombar-inner {
    font-size: 13px;
    gap: 8px;
  }

  .amcod-so-cd-num {
    font-size: 22px;
    padding: 3px 8px;
  }

  .amcod-so-fullscreen-content {
    padding: 20px;
  }

  .amcod-so-fullscreen-content .amcod-so-title {
    font-size: 24px;
  }
}
