/* Final Badge Fix - Properly positioned on border */

/* First, ensure all parent containers allow overflow */
.predplatne-container,
.predplatne-form,
#predplatne-form,
.predplatne-step,
.predplatne-step-druh,
.predplatne-step-chut,
.predplatne-step-frekvence,
.predplatne-step-doba,
.checkout-main-content,
.checkout-main-content-step,
.predplatne-boxes,
.druh-boxes,
.chut-boxes,
.jak-casto-boxes,
.balicky-boxes,
.doba-boxes {
    overflow: visible !important;
    position: relative;
    transform: none !important;
}

/* Ensure boxes have proper border and allow overflow */
.predplatne-box {
    overflow: visible !important;
    position: relative !important;
    border: 2px solid #e0e0e0 !important; /* Ensure consistent border */
    z-index: 1;
}

/* Remove transform from any parent that might create stacking context */
.vyber-kafe-obsah,
#step-kafe,
.predplatne-form-step {
    transform: none !important;
}

/* Badge positioning - exactly on the 2px border */
.predplatne-box .popular-badge {
    position: absolute !important;
    top: -2px !important; /* Exactly on the 2px border */
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: #ff6b6b !important;
    color: white !important;
    padding: 5px 18px !important;
    border-radius: 14px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3) !important;
    z-index: 1000 !important; /* Very high to ensure visibility */
    white-space: nowrap !important;
    line-height: 1.3 !important;
    width: auto !important;
    right: auto !important;
    display: inline-block !important;
    margin: 0 !important;
}

/* CRITICAL FIX: Ensure badge text is always white, even in active boxes */
.predplatne-box.active .popular-badge {
    color: white !important;
}

/* Hide badges with inline display:none */
.popular-badge[style*="display: none"] {
    display: none !important;
}

/* Ensure box-header doesn't interfere */
.predplatne-box .box-header {
    position: static !important; /* Remove relative positioning */
    z-index: auto !important;
    overflow: visible !important;
}

/* Add padding to boxes container for badge overflow */
.predplatne-boxes,
.druh-boxes,
.chut-boxes,
.jak-casto-boxes,
.balicky-boxes,
.doba-boxes {
    padding-top: 15px !important;
    margin-top: 5px !important;
}

/* Ensure first box in each group has space for badge */
.predplatne-boxes .predplatne-box:first-child {
    margin-top: 0 !important;
}

/* Special handling for smaller boxes */
.jak-casto-boxes .predplatne-box .popular-badge,
.doba-boxes .predplatne-box .popular-badge {
    font-size: 0.7rem !important;
    padding: 4px 14px !important;
}

/* Fix for longer badge text */
.predplatne-box .popular-badge {
    min-width: fit-content !important;
    padding: 5px 12px !important; /* Reduced horizontal padding */
}

/* Automatically reduce font size for longer text */
.predplatne-box .popular-badge.long-text,
.predplatne-box .popular-badge:has-text("Doporučujeme"),
.predplatne-box .popular-badge:has-text("Nejpopulárnější") {
    font-size: 0.7rem !important;
    letter-spacing: -0.02em !important;
    padding: 4px 10px !important;
}

/* Ensure box content doesn't interfere */
.predplatne-box > * {
    position: relative;
    z-index: 2;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .predplatne-box .popular-badge {
        font-size: 0.65rem !important;
        padding: 3px 12px !important;
        border-radius: 10px !important;
    }
    
    .predplatne-boxes,
    .druh-boxes,
    .chut-boxes,
    .jak-casto-boxes,
    .balicky-boxes,
    .doba-boxes {
        padding-top: 12px !important;
    }
}

/* Debug styles - uncomment to visualize positioning */
/*
.predplatne-box {
    background: rgba(0, 255, 0, 0.1) !important;
}
.popular-badge {
    background: rgba(255, 0, 0, 0.8) !important;
}
.predplatne-box::before {
    content: 'BORDER';
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 10px;
    color: red;
}
*/