/* Common CSS variables default fallback */
.ivanivi-countdown-wrapper {
    --sue-cb-bg: #f8fafc;
    --sue-cb-border-color: #cbd5e1;
    --sue-cb-border-width: 1px;
    --sue-cb-border-radius: 12px;
    --sue-cb-num-size: 32px;
    --sue-cb-lbl-size: 12px;
    --sue-cb-scale: 1; /* Default scale factor is 1 */

    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: calc(20px * var(--sue-cb-scale));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 15px 0;
    box-sizing: border-box;
    max-width: 100%;
}

/* Common Item Layout */
.ivanivi-countdown-wrapper .countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ivanivi-countdown-wrapper .countdown-value-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.ivanivi-countdown-wrapper .countdown-value {
    font-size: calc(var(--sue-cb-num-size) * var(--sue-cb-scale));
    font-weight: 700;
    line-height: 1;
}
.ivanivi-countdown-wrapper .countdown-label {
    font-size: calc(var(--sue-cb-lbl-size) * var(--sue-cb-scale));
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: calc(8px * var(--sue-cb-scale));
    line-height: 1;
}

/* Style: Simple (Cajas/Bloques) */
.ivanivi-countdown-wrapper.style-simple .countdown-item {
    background-color: var(--sue-cb-bg);
    border: var(--sue-cb-border-width) solid var(--sue-cb-border-color);
    border-radius: calc(var(--sue-cb-border-radius) * var(--sue-cb-scale));
    padding: calc(15px * var(--sue-cb-scale)) calc(20px * var(--sue-cb-scale));
    min-width: calc(80px * var(--sue-cb-scale));
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

/* Style: Circular Rings */
.ivanivi-countdown-wrapper.style-circular {
    gap: calc(30px * var(--sue-cb-scale));
}
.ivanivi-countdown-wrapper.style-circular .countdown-value-wrapper {
    width: calc(90px * var(--sue-cb-scale));
    height: calc(90px * var(--sue-cb-scale));
}
.ivanivi-countdown-wrapper.style-circular .circular-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start progress from top */
}
.ivanivi-countdown-wrapper.style-circular .circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: calc(6px * var(--sue-cb-scale));
}
.ivanivi-countdown-wrapper.style-circular .circle-progress {
    fill: none;
    stroke-width: calc(6px * var(--sue-cb-scale));
    stroke-linecap: round;
    stroke-dasharray: 282.74; /* 2 * PI * r (r=45) */
    stroke-dashoffset: 282.74;
    transition: stroke-dashoffset 1s linear;
}
.ivanivi-countdown-wrapper.style-circular .countdown-value {
    position: relative;
    z-index: 2;
}

/* Style: Digital Minimalist */
.ivanivi-countdown-wrapper.style-digital {
    gap: calc(10px * var(--sue-cb-scale));
}
.ivanivi-countdown-wrapper.style-digital .countdown-item {
    align-items: center;
}
.ivanivi-countdown-wrapper.style-digital .countdown-sep {
    font-size: calc(var(--sue-cb-num-size) * var(--sue-cb-scale));
    font-weight: 700;
    line-height: 1;
    margin-bottom: calc(20px * var(--sue-cb-scale)); /* offset to center with numbers (no label) */
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Message alert on end */
.sue-cb-expired-message {
    padding: 20px 30px;
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    border-radius: 12px;
    color: #991b1b;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    margin: 15px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Container Queries for responsive scaling based on container width */
.ivanivi-countdown-container {
    container-type: inline-size;
    container-name: countdown;
    width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    align-self: stretch;
}

@container (max-width: 500px) {
    .ivanivi-countdown-wrapper {
        --sue-cb-scale: 0.8 !important;
        margin: 10px auto !important;
        max-width: 100% !important;
        display: inline-flex !important;
        flex-wrap: nowrap !important;
    }

    /* Simple layout box styling */
    .ivanivi-countdown-wrapper.style-simple .countdown-item {
        padding: calc(15px * var(--sue-cb-scale)) calc(12px * var(--sue-cb-scale)) !important;
        min-width: 0 !important;
        flex: 1 1 0% !important;
    }
}

@container (max-width: 380px) {
    .ivanivi-countdown-wrapper {
        --sue-cb-scale: 0.62 !important;
    }
    .ivanivi-countdown-wrapper.style-simple .countdown-item {
        padding: calc(12px * var(--sue-cb-scale)) calc(9px * var(--sue-cb-scale)) !important;
    }
}

@container (max-width: 280px) {
    .ivanivi-countdown-wrapper {
        --sue-cb-scale: 0.45 !important;
    }
    .ivanivi-countdown-wrapper.style-simple .countdown-item {
        padding: calc(10px * var(--sue-cb-scale)) calc(6px * var(--sue-cb-scale)) !important;
    }
}
