/* Floating timer — компактный бар внизу, 80% ширины по центру */

/* 1. Контейнер */
.floating-timer-widget {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 20px));
    width: 80%;
    max-width: 1100px;
    z-index: 1400;
    font-family: var(--font-family-base);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.floating-timer-widget.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.floating-timer-widget.hiding {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(calc(100% + 20px));
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.floating-timer-widget.floating-timer--hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(calc(100% + 20px));
    transition: opacity 1s ease, transform 1s ease;
    pointer-events: none;
}

/* 2. Карточка */
.floating-timer-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 12px 28px 12px 24px;
    background: linear-gradient(
        180deg,
        rgb(22, 18, 44) 0%,
        rgb(14, 10, 32) 100%
    );
    border: 1px solid rgba(139, 92, 246, 0.18);
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

/* Shimmer */
.floating-timer-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 40%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(139, 92, 246, 0.03) 30%,
        rgba(255, 255, 255, 0.015) 50%,
        rgba(139, 92, 246, 0.03) 70%,
        transparent 100%
    );
    animation: none;
    pointer-events: none;
}

@keyframes ftShimmer {
    0%, 100% { left: -120%; }
    45%, 55% { left: 120%; }
}

/* 3. Sublabel — скрыт в горизонтальном режиме */
.floating-timer-sublabel {
    display: none;
}

/* 4. Цифры таймера */
.floating-timer-digits {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.floating-timer-digit-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 36px;
}

.floating-timer-digit-value {
    font-family: var(--font-family-base);
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    line-height: 1;
    text-align: center;
    background: linear-gradient(175deg, #f8f8ff 0%, #ddd6fe 35%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(139, 92, 246, 0.1));
}

.floating-timer-digit-unit {
    font-family: var(--font-family-base);
    font-size: 7px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(232, 238, 243, 0.25);
    line-height: 1;
}

.floating-timer-sep {
    font-family: var(--font-family-base);
    font-size: 16px;
    font-weight: 300;
    color: rgba(139, 92, 246, 0.4);
    line-height: 1;
    margin: 0 -1px;
    padding-bottom: 10px;
    animation: ftBlink 1.2s steps(2, start) infinite;
}

@keyframes ftBlink {
    50% { opacity: 0; }
}

/* 5. Разделитель — вертикальный */
.floating-timer-divider {
    width: 1px;
    height: 26px;
    flex-shrink: 0;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(139, 92, 246, 0.18) 50%,
        transparent 100%);
}

/* 6. Фраза — фиксированная зона */
.floating-timer-phrase {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    flex: 0 1 320px;
    max-width: 320px;
}

.floating-timer-phrase-text {
    font-family: var(--font-family-base);
    font-size: 12px;
    font-weight: 500;
    color: rgba(232, 238, 243, 0.55);
    text-align: center;
    line-height: 1.35;
    letter-spacing: 0.15px;
    width: 100%;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.floating-timer-phrase-text.fading-out {
    opacity: 0;
    transform: translateY(-6px);
}

.floating-timer-phrase-text.fading-in {
    opacity: 0;
    transform: translateY(6px);
}

/* 7. Прогресс-бар — тонкая полоска сверху */
.floating-timer-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(139, 92, 246, 0.06);
    overflow: hidden;
    border-radius: 18px 18px 0 0;
}

.floating-timer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed 0%, #8b5cf6 40%, #a78bfa 100%);
    transition: width 1s linear;
    position: relative;
}

.floating-timer-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
}

/* 8. Цена + кнопка (группа справа) */
.floating-timer-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 4px;
}

.floating-timer-price + .floating-timer-cta {
    margin-left: 4px;
}

.ft-old-price {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.25);
    text-decoration: line-through;
}

.ft-new-price {
    font-size: 18px;
    font-weight: 800;
    color: #22c55e;
    letter-spacing: -0.3px;
    text-shadow: none;
}

/* 9. Кнопка CTA — стиль как у превью-кнопки */
.floating-timer-cta {
    padding: 9px 28px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-family-heading);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #ffffff;
    background: linear-gradient(135deg,
        #065f46 0%,
        #047857 15%,
        #059669 30%,
        #10b981 45%,
        #059669 60%,
        #047857 75%,
        #065f46 90%,
        #064e3b 100%);
    background-size: 400% 400%;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background-position 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.floating-timer-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s ease;
    z-index: 1;
}

.floating-timer-cta:hover {
    transform: translateY(-1px) scale(1.02);
    background-position: 100% 50%;
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.25);
}

.floating-timer-cta:hover::before {
    left: 100%;
}

.floating-timer-cta:active {
    transform: translateY(0) scale(1);
}

/* 10. Состояния срочности */
.floating-timer-widget.ft-warning .floating-timer-digit-value {
    background: linear-gradient(175deg, #fffbeb 0%, #fde68a 35%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(251, 191, 36, 0.2));
}

.floating-timer-widget.ft-warning .floating-timer-sep {
    color: rgba(251, 191, 36, 0.4);
}

.floating-timer-widget.ft-warning .floating-timer-progress-fill {
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 40%, #fbbf24 100%);
}

.floating-timer-widget.ft-warning .floating-timer-card {
    border-color: rgba(251, 191, 36, 0.18);
}

/* Срочно: < 1 часа */
.floating-timer-widget.ft-urgent .floating-timer-digit-value {
    background: linear-gradient(175deg, #fff1f2 0%, #fecaca 35%, #f87171 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(248, 113, 113, 0.25));
}

.floating-timer-widget.ft-urgent .floating-timer-sep {
    color: rgba(248, 113, 113, 0.45);
}

.floating-timer-widget.ft-urgent .floating-timer-progress-fill {
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 40%, #f87171 100%);
}

.floating-timer-widget.ft-urgent .floating-timer-card {
    border-color: rgba(248, 113, 113, 0.2);
}

.floating-timer-widget.ft-urgent .floating-timer-phrase-text {
    color: rgba(252, 165, 165, 0.65);
}

/* Истекло */
.floating-timer-widget.ft-expired .floating-timer-digit-value {
    background: linear-gradient(175deg, #ecfdf5 0%, #a7f3d0 35%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(16, 185, 129, 0.2));
    font-size: 12px;
    letter-spacing: 0.3px;
}

.floating-timer-widget.ft-expired .floating-timer-progress-fill {
    width: 100% !important;
    background: linear-gradient(90deg, #059669 0%, #10b981 40%, #34d399 100%);
}

.floating-timer-widget.ft-expired .floating-timer-card {
    border-color: rgba(16, 185, 129, 0.2);
}

.floating-timer-widget.ft-expired .floating-timer-phrase-text {
    color: rgba(167, 243, 208, 0.65);
    font-weight: 600;
}

.floating-timer-widget.ft-expired .floating-timer-sep {
    color: rgba(16, 185, 129, 0.4);
}

/* 10.5 Компактный режим — без цены и кнопки (этап превью) */

.floating-timer-widget.ft-compact .floating-timer-price,
.floating-timer-widget.ft-compact .floating-timer-cta,
.floating-timer-widget.ft-compact .floating-timer-price + .floating-timer-cta {
    display: none !important;
}

.floating-timer-widget.ft-compact .floating-timer-divider:last-of-type {
    display: none;
}

.floating-timer-widget.ft-compact .floating-timer-card {
    justify-content: center;
}

/* 11. Адаптивность */
/* Широкие экраны — крупнее шрифт фразы при наличии места */
@media (min-width: 1200px) {
    .floating-timer-phrase {
        flex: 0 1 360px;
        max-width: 360px;
    }
    .floating-timer-phrase-text {
        font-size: 13px;
        color: rgba(232, 238, 243, 0.6);
    }
}

@media (min-width: 1400px) {
    .floating-timer-phrase {
        flex: 0 1 400px;
        max-width: 400px;
    }
    .floating-timer-phrase-text {
        font-size: 14px;
        line-height: 1.4;
    }
}

@media (min-width: 1600px) {
    .floating-timer-phrase-text {
        font-size: 15px;
    }
}

/* Средние десктопы */
@media (max-width: 1100px) {
    .floating-timer-card {
        gap: 18px;
        padding: 11px 24px;
    }

    .floating-timer-phrase {
        flex: 0 1 280px;
        max-width: 280px;
    }

    .floating-timer-phrase-text {
        font-size: 11px;
    }
}

/* Планшеты — фраза в 2 строки допустима */
@media (max-width: 900px) {
    .floating-timer-widget {
        width: 88%;
    }

    .floating-timer-card {
        gap: 14px;
        padding: 10px 18px;
        border-radius: 14px;
    }

    .floating-timer-phrase {
        flex: 0 1 240px;
        max-width: 240px;
    }

    .floating-timer-phrase-text {
        font-size: 10.5px;
        white-space: normal;
        line-height: 1.3;
    }

    .floating-timer-digit-value {
        font-size: 20px;
    }

    .floating-timer-cta {
        padding: 8px 20px;
        font-size: 11px;
        border-radius: 10px;
    }

    .ft-new-price { font-size: 16px; }
    .ft-old-price { font-size: 11px; }
}

/* Мобильные — фраза сверху, затем таймер + цена + кнопка */
@media (max-width: 640px) {
    .floating-timer-widget {
        width: 92%;
        bottom: 10px;
    }

    .floating-timer-card {
        flex-wrap: wrap;
        gap: 8px 14px;
        padding: 10px 16px;
        border-radius: 14px;
        justify-content: center;
    }

    .floating-timer-phrase {
        order: 1;
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
        margin-bottom: 2px;
    }

    .floating-timer-phrase-text {
        font-size: 11px;
        white-space: normal;
        line-height: 1.3;
    }

    .floating-timer-divider {
        display: none;
    }

    .floating-timer-digits {
        order: 2;
    }

    .floating-timer-price {
        order: 3;
    }

    .floating-timer-cta {
        order: 4;
        width: 100%;
        padding: 9px 20px;
        font-size: 11px;
        border-radius: 10px;
        text-align: center;
    }

    .floating-timer-digit-value {
        font-size: 20px;
    }

    .floating-timer-digit-group {
        min-width: 30px;
    }

    .floating-timer-sep {
        font-size: 14px;
        padding-bottom: 8px;
    }

    .ft-old-price { font-size: 11px; }
    .ft-new-price { font-size: 16px; }
}

/* Маленькие мобильные */
@media (max-width: 400px) {
    .floating-timer-widget {
        width: 94%;
        bottom: 8px;
    }

    .floating-timer-card {
        gap: 6px 10px;
        padding: 8px 12px;
        border-radius: 12px;
    }

    .floating-timer-phrase-text {
        font-size: 10px;
    }

    .floating-timer-digit-value {
        font-size: 18px;
    }

    .floating-timer-digit-group {
        min-width: 26px;
    }

    .floating-timer-sep {
        font-size: 12px;
        padding-bottom: 7px;
    }

    .floating-timer-digit-unit {
        font-size: 6px;
    }

    .ft-old-price { font-size: 10px; }
    .ft-new-price { font-size: 14px; }
    .floating-timer-price { gap: 6px; }

    .floating-timer-cta {
        padding: 8px 16px;
        font-size: 10px;
        border-radius: 9px;
    }
}

/* Ландшафтная ориентация */
@media (max-height: 500px) and (orientation: landscape) {
    .floating-timer-widget {
        bottom: 6px;
    }

    .floating-timer-card {
        padding: 7px 24px;
        gap: 16px;
    }

    .floating-timer-digit-value {
        font-size: 18px;
    }

    .floating-timer-phrase {
        display: flex;
    }

    .floating-timer-phrase-text {
        font-size: 10px;
    }

    .floating-timer-cta {
        padding: 6px 20px;
        font-size: 10px;
    }
}

/* 12. Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .floating-timer-widget {
        transition: opacity 0.3s ease;
        transform: translateX(-50%) !important;
    }
    .floating-timer-widget.visible {
        transform: translateX(-50%) !important;
    }
    .floating-timer-card::after {
        animation: none;
        display: none;
    }
    .floating-timer-sep {
        animation: none;
        opacity: 0.4;
    }
    .floating-timer-progress-fill::after {
        display: none;
    }
    .floating-timer-phrase-text {
        transition: none;
    }
    .floating-timer-cta {
        animation: none;
    }
}
