/* ===========================
   COUNTDOWN MASTER — Frontend
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;600&display=swap');

:root {
  --cdm-radius: 12px;
  --cdm-font-display: 'Bebas Neue', cursive;
  --cdm-font-body: 'Inter', sans-serif;
}

.cdm-wrapper {
  font-family: var(--cdm-font-body);
  text-align: center;
  padding: 32px 24px;
  border-radius: var(--cdm-radius);
  display: inline-block;
  width: 100%;
  max-width: 640px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* ==== ТЕМА: ТЪМНА ==== */
.cdm-theme-dark {
  background: #0f0f13;
  border: 1px solid #2a2a35;
  color: #ffffff;
}
.cdm-theme-dark .cdm-title { color: #ffffff; }
.cdm-theme-dark .cdm-subtitle { color: #8888aa; }
.cdm-theme-dark .cdm-number { background: #1e1e2a; color: #ffffff; border: 1px solid #333; }
.cdm-theme-dark .cdm-label { color: #666680; }
.cdm-theme-dark .cdm-sep { color: #444; }

/* ==== ТЕМА: СВЕТЛА ==== */
.cdm-theme-light {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  color: #1a1a1a;
}
.cdm-theme-light .cdm-title { color: #1a1a1a; }
.cdm-theme-light .cdm-subtitle { color: #666; }
.cdm-theme-light .cdm-number { background: #ffffff; color: #1a1a1a; border: 1px solid #ddd; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.cdm-theme-light .cdm-label { color: #999; }
.cdm-theme-light .cdm-sep { color: #ccc; }

/* ==== ТЕМА: ГРАДИЕНТ ==== */
.cdm-theme-gradient {
  background: linear-gradient(135deg, #1a0533 0%, #0d1f4a 50%, #001a3a 100%);
  color: #ffffff;
  border: none;
}
.cdm-theme-gradient::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at center, rgba(138,43,226,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.cdm-theme-gradient .cdm-title { color: #ffffff; text-shadow: 0 0 20px rgba(138,43,226,0.5); }
.cdm-theme-gradient .cdm-subtitle { color: rgba(255,255,255,0.7); }
.cdm-theme-gradient .cdm-number {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  border: 1px solid rgba(138,43,226,0.4);
  box-shadow: 0 0 20px rgba(138,43,226,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}
.cdm-theme-gradient .cdm-label { color: rgba(255,255,255,0.5); }
.cdm-theme-gradient .cdm-sep { color: rgba(138,43,226,0.6); }

/* ==== ТЕМА: МИНИМАЛ ==== */
.cdm-theme-minimal {
  background: transparent;
  border: none;
  color: inherit;
}
.cdm-theme-minimal .cdm-number {
  background: transparent;
  color: inherit;
  border: none;
  border-bottom: 3px solid currentColor;
  border-radius: 0;
  font-size: 3.5rem;
}
.cdm-theme-minimal .cdm-label { color: inherit; opacity: 0.5; font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; }
.cdm-theme-minimal .cdm-sep { opacity: 0.3; }

/* ==== ТЕМА: ОГНЕНА ==== */
.cdm-theme-fire {
  background: linear-gradient(160deg, #1a0000 0%, #3d0a00 100%);
  border: 1px solid #ff4400;
  color: #fff;
  box-shadow: 0 0 40px rgba(255,68,0,0.3), inset 0 0 60px rgba(255,68,0,0.05);
}
.cdm-theme-fire .cdm-title { color: #ff8844; text-shadow: 0 0 10px rgba(255,100,0,0.7); }
.cdm-theme-fire .cdm-subtitle { color: rgba(255,150,100,0.7); }
.cdm-theme-fire .cdm-number {
  background: rgba(255,50,0,0.15);
  color: #ff8844;
  border: 1px solid rgba(255,68,0,0.5);
  box-shadow: 0 0 12px rgba(255,68,0,0.3);
}
.cdm-theme-fire .cdm-label { color: rgba(255,100,50,0.6); }
.cdm-theme-fire .cdm-sep { color: #ff4400; }

/* ==== ТЕМА: ОКЕАН ==== */
.cdm-theme-ocean {
  background: linear-gradient(160deg, #001825 0%, #003855 100%);
  border: 1px solid #0088cc;
  color: #fff;
  box-shadow: 0 0 40px rgba(0,136,204,0.2);
}
.cdm-theme-ocean .cdm-title { color: #44ccff; text-shadow: 0 0 10px rgba(0,180,255,0.5); }
.cdm-theme-ocean .cdm-subtitle { color: rgba(100,200,255,0.7); }
.cdm-theme-ocean .cdm-number {
  background: rgba(0,136,204,0.15);
  color: #44ccff;
  border: 1px solid rgba(0,136,204,0.4);
  box-shadow: 0 0 12px rgba(0,136,204,0.2);
}
.cdm-theme-ocean .cdm-label { color: rgba(100,200,255,0.5); }
.cdm-theme-ocean .cdm-sep { color: #0088cc; }

/* ==== ОБЩИ СТИЛОВЕ ==== */
.cdm-title {
  font-family: var(--cdm-font-display);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  letter-spacing: 0.05em;
  margin: 0 0 6px;
  line-height: 1.1;
}

.cdm-subtitle {
  font-size: 0.88rem;
  margin: 0 0 28px;
  line-height: 1.5;
}

.cdm-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cdm-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cdm-number {
  font-family: var(--cdm-font-display);
  font-size: clamp(2rem, 7vw, 3.5rem);
  min-width: clamp(60px, 12vw, 90px);
  padding: 12px 8px;
  border-radius: 10px;
  line-height: 1;
  letter-spacing: 0.04em;
  transition: transform 0.1s ease;
  display: block;
}

.cdm-number.cdm-flip {
  transform: scaleY(0.85);
}

.cdm-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.cdm-sep {
  font-family: var(--cdm-font-display);
  font-size: clamp(1.5rem, 5vw, 2.8rem);
  line-height: 1;
  margin-bottom: 22px;
  opacity: 0.7;
}

.cdm-expired-msg {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 16px;
  margin-top: 16px;
  animation: cdm-fade-in 0.5s ease;
}

/* ==== POPUP ==== */
.cdm-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cdm-fade-in 0.3s ease;
}

.cdm-has-overlay {
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}

.cdm-popup-box {
  position: relative;
  max-width: 520px;
  width: 90%;
  border-radius: 16px;
  animation: cdm-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 25px 80px rgba(0,0,0,0.5);
}

.cdm-popup-box .cdm-wrapper {
  max-width: 100%;
  border-radius: 16px;
}

.cdm-popup-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cdm-popup-close:hover {
  background: #ff4444;
  color: #fff;
  transform: scale(1.1) rotate(90deg);
}

/* ==== ANIMАЦИИ ==== */
@keyframes cdm-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cdm-pop-in {
  from { opacity: 0; transform: scale(0.75) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.cdm-error {
  color: #cc3333;
  font-size: 0.85rem;
  font-style: italic;
}

/* ==== RESPONSIVE ==== */
@media (max-width: 480px) {
  .cdm-wrapper { padding: 24px 16px; }
  .cdm-timer { gap: 4px; }
  .cdm-sep { font-size: 1.5rem; }
}
