/* Conversion Bars Frontend Styles */

/* Base bar styles */
.cb-bar {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
}

.cb-bar-inner {
    position: relative;
}

.cb-bar.cb-active {
    display: block;
}

/* Position */
.cb-bar.cb-position-top {
    top: 0;
}

.cb-bar.cb-position-bottom {
    bottom: 0;
}

/* Scroll mode */
.cb-bar.cb-scroll-fixed {
    position: fixed;
}

.cb-bar.cb-scroll-scroll {
    position: absolute;
}

/* Push mode - handled by JS */
body.cb-push-active.cb-bar-top {
    padding-top: 0; /* Will be set dynamically by JS */
}

body.cb-push-active.cb-bar-bottom {
    padding-bottom: 0; /* Will be set dynamically by JS */
}

/* Ensure body has no margin when bar is active */
body.cb-push-active {
    margin-top: 0 !important;
}

/* Drop shadow */
.cb-bar.cb-dropshadow {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

/* Bar inner container */
.cb-bar-inner {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 15px 0 15px 0;
    width: 100%;
    margin: 0;
    position: relative;
}

/* Bar height variations */
.cb-bar.cb-height-compact .cb-bar-inner {
    padding: 8px 0 8px 0;
}

.cb-bar.cb-height-large .cb-bar-inner {
    padding: 25px 0 25px 0;
}

/* Countdown - absolutely positioned on left */
.cb-countdown {
    grid-column: unset;
}

/* Text and button wrapper - centered, with left margin for countdown space */
.cb-bar-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-left: 280px;
    margin-right: 50px;
}

.cb-bar.cb-height-compact .cb-bar-content-wrapper {
    gap: 15px;
    margin-left: 260px;
}

.cb-bar.cb-height-large .cb-bar-content-wrapper {
    gap: 25px;
    margin-left: 300px;
}

.cb-bar-text {
    flex: 0 0 auto;
    text-align: center;
}

.cb-button {
    flex: 0 0 auto;
}

/* Close button - top right corner */
.cb-close-btn {
    position: absolute;
    right: 0;
    top: 0;
    transform: none;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.8;
    transition: all 0.2s ease;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 0 3px;
}

.cb-close-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.3);
}

/* Countdown timer */
.cb-countdown {
    display: flex;
    gap: 10px;
    padding: 0 20px;
    border-radius: 0;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    clip-path: polygon(0 0, 100% 0, calc(100% - 20px) 100%, 0 100%);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.15);
    align-items: center;
}

/* Countdown doesn't need margin adjustments for different heights - it stretches full height */

.cb-countdown-unit {
    text-align: center;
    min-width: 50px;
}

.cb-countdown-value {
    display: block;
    font-size: 24px;
    line-height: 1;
    margin-bottom: 5px;
    font-weight: bold;
}

.cb-countdown-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Button */
.cb-button {
    display: inline-block;
    padding: 12px 30px;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cb-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cb-button-rounded {
    border-radius: 25px;
}

.cb-button-square {
    border-radius: 4px;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes shake-pause-repeat {
    /* Shake happens in first 12.5% of the animation (0.5 seconds of 4 second cycle) */
    0% { transform: translateX(0); }
    1.25% { transform: translateX(-5px); }
    2.5% { transform: translateX(5px); }
    3.75% { transform: translateX(-5px); }
    5% { transform: translateX(5px); }
    6.25% { transform: translateX(-5px); }
    7.5% { transform: translateX(5px); }
    8.75% { transform: translateX(-5px); }
    10% { transform: translateX(5px); }
    11.25% { transform: translateX(-5px); }
    12.5% { transform: translateX(0); }
    /* Pause for the remaining 87.5% (3.5 seconds) */
    100% { transform: translateX(0); }
}

@keyframes pulse-pause-repeat {
    /* Pulse happens in first 37.5% of animation (1.5 seconds of 4 second cycle) */
    0% { transform: scale(1); }
    9.375% { transform: scale(1.05); }
    18.75% { transform: scale(1.1); }
    28.125% { transform: scale(1.05); }
    37.5% { transform: scale(1); }
    /* Pause for remaining 62.5% (2.5 seconds) */
    100% { transform: scale(1); }
}

@keyframes bounce-pause-repeat {
    /* Bounce happens in first 25% of animation (1 second of 4 second cycle) */
    0% { transform: translateY(0); }
    6.25% { transform: translateY(-10px); }
    12.5% { transform: translateY(0); }
    18.75% { transform: translateY(-10px); }
    25% { transform: translateY(0); }
    /* Pause for remaining 75% (3 seconds) */
    100% { transform: translateY(0); }
}

.cb-animate-shake {
    animation: shake-pause-repeat 4s ease-in-out infinite;
}

.cb-animate-pulse {
    animation: pulse-pause-repeat 4s ease-in-out infinite;
}

.cb-animate-bounce {
    animation: bounce-pause-repeat 4s ease-in-out infinite;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cb-bar.cb-position-top.cb-fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeInBottom {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cb-bar.cb-position-bottom.cb-fade-in {
    animation: fadeInBottom 0.5s ease;
}

/* Slide in animations */
@keyframes slideInTop {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInBottom {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.cb-bar.cb-position-top.cb-slide-in {
    animation: slideInTop 0.5s ease;
}

.cb-bar.cb-position-bottom.cb-slide-in {
    animation: slideInBottom 0.5s ease;
}

/* Fade out animation */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.cb-bar.cb-position-top.cb-fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOutBottom {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.cb-bar.cb-position-bottom.cb-fade-out {
    animation: fadeOutBottom 0.3s ease;
}

/* Expired state */
.cb-countdown.cb-expired .cb-countdown-unit {
    display: none;
}

.cb-countdown.cb-expired::after {
    content: attr(data-expiry-text);
    font-size: 18px;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .cb-bar-inner {
        flex-direction: column;
        padding: 15px 15px 15px 15px;
        gap: 12px;
    }
    
    .cb-countdown {
        gap: 8px;
        padding: 10px 15px;
        margin-left: 0;
        clip-path: none;
        border-radius: 4px;
    }
    
    .cb-countdown-unit {
        min-width: 40px;
    }
    
    .cb-countdown-value {
        font-size: 18px;
    }
    
    .cb-countdown-label {
        font-size: 8px;
    }
    
    .cb-button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .cb-bar-text {
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .cb-bar-inner {
        padding: 12px 35px 12px 12px;
        gap: 10px;
    }
    
    .cb-countdown {
        gap: 5px;
        padding: 6px 10px;
    }
    
    .cb-countdown-unit {
        min-width: 35px;
    }
    
    .cb-countdown-value {
        font-size: 16px;
    }
    
    .cb-countdown-label {
        font-size: 7px;
    }
    
    .cb-button {
        padding: 8px 16px;
        font-size: 13px;
        width: 100%;
        text-align: center;
    }
    
    .cb-bar-text {
        font-size: 13px;
    }
    
    .cb-close-btn {
        font-size: 24px;
        right: 10px;
    }
}
