/**
 * TwoPixels Gratisversand-Balken v3.0
 * Erweitertes CSS mit Sticky, Countdown, Produkt-Empfehlungen,
 * Urgency Timer, Social Proof, Konfetti-Effekt
 */

/* ===== Basis-Container ===== */
.tp-freeship {
    padding: 15px 20px;
    margin-bottom: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

/* ===== Position: Warenkorb ===== */
.tp-freeship--cart {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Position: Header/Mini-Warenkorb ===== */
.tp-freeship--header {
    padding: 10px 15px;
    margin: 0 0 10px 0;
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #eee;
}

.tp-freeship--header .tp-freeship__text {
    font-size: 12px;
    margin-bottom: 8px;
}

.tp-freeship--header .tp-freeship__progress {
    height: 6px;
}

/* ===== Position: Sticky ===== */
.tp-freeship--sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 12px 20px;
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 9998;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.tp-freeship--sticky.tp-freeship--visible {
    transform: translateY(0);
}

.tp-freeship--sticky .tp-freeship__text {
    margin-bottom: 8px;
}

.tp-freeship--sticky .tp-freeship__close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

/* ===== Position: Checkout ===== */
.tp-freeship--checkout {
    max-width: 100%;
    margin-bottom: 25px;
    border: 2px solid #4ecdc4;
}

/* ===== Position: Produktseite ===== */
.tp-freeship--product {
    margin-bottom: 15px;
    padding: 12px 15px;
    font-size: 13px;
}

.tp-freeship--product .tp-freeship__progress {
    height: 6px;
}

/* ===== Text ===== */
.tp-freeship__text {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.tp-freeship__text strong {
    color: #e74c3c;
    font-weight: 700;
}

/* ===== Erfolgs-Zustand ===== */
.tp-freeship--complete {
    border-color: #4ecdc4;
}

.tp-freeship--complete .tp-freeship__text {
    color: #27ae60;
    font-weight: 600;
}

.tp-freeship--complete .tp-freeship__text strong {
    color: #27ae60;
}

.tp-freeship--complete .tp-freeship__text::before {
    content: "\2713 ";
    font-weight: bold;
}

/* ===== Fortschrittsbalken ===== */
.tp-freeship__progress {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.tp-freeship__fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out, background 0.3s ease;
    background: linear-gradient(90deg, #ff6b6b 0%, #feca57 50%, #4ecdc4 100%);
    background-size: 200% 100%;
    animation: tp-freeship-gradient 2s ease infinite;
}

@keyframes tp-freeship-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.tp-freeship--complete .tp-freeship__fill {
    animation: none;
    background: #4ecdc4;
}

/* Fast erreicht - Pulse */
.tp-freeship--almost .tp-freeship__fill {
    animation: tp-freeship-pulse 1.5s ease-in-out infinite;
}

@keyframes tp-freeship-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===== Countdown ===== */
.tp-freeship__countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: linear-gradient(90deg, #ff6b6b, #ee5a5a);
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.tp-freeship__countdown-text {
    opacity: 0.9;
}

.tp-freeship__countdown-timer {
    font-family: monospace;
    font-size: 14px;
    letter-spacing: 1px;
}

.tp-freeship--complete .tp-freeship__countdown {
    display: none;
}

/* ===== Gutschein ===== */
.tp-freeship__coupon {
    margin-top: 12px;
    padding: 10px 15px;
    background-color: rgba(0,0,0,0.03);
    border-radius: 4px;
    font-size: 13px;
    color: #555;
}

.tp-freeship__coupon-code {
    display: inline-block;
    padding: 3px 8px;
    background-color: #fff;
    border: 1px dashed #999;
    border-radius: 3px;
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tp-freeship__coupon-code:hover {
    background-color: #fffde7;
}

.tp-freeship__coupon-code.copied {
    background-color: #c8e6c9;
    border-color: #4caf50;
}

/* ===== Produkt-Empfehlungen ===== */
.tp-freeship__products {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.tp-freeship__products-title {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.tp-freeship__products-list {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.tp-freeship__product {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    width: 140px;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tp-freeship__product:hover {
    border-color: #4ecdc4;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.2);
}

.tp-freeship__product-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.tp-freeship__product-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}

.tp-freeship__product-name {
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
    color: #333;
    min-height: 42px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.tp-freeship__product-price {
    font-size: 13px;
    font-weight: 700;
    color: #e74c3c;
}

.tp-freeship__product-add {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #4ecdc4;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
    line-height: 1;
}

.tp-freeship__product-add:hover {
    background: #3dbdb5;
    transform: scale(1.1);
}

.tp-freeship__product-add:active {
    transform: scale(0.95);
}

.tp-freeship__product-add.added {
    background: #27ae60;
}

.tp-freeship__product-add-icon {
    display: block;
}

.tp-freeship__product-form {
    position: absolute;
    top: 5px;
    right: 5px;
    margin: 0;
    padding: 0;
}

/* ===== Animationen ===== */
.tp-freeship {
    animation: tp-freeship-fadein 0.4s ease-out;
}

@keyframes tp-freeship-fadein {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 991px) {
    .tp-freeship__product {
        width: 100px;
    }

    .tp-freeship__product-img {
        width: 50px;
        height: 50px;
    }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 767px) {
    .tp-freeship {
        padding: 12px 15px;
        margin-bottom: 15px;
    }

    .tp-freeship__text {
        font-size: 13px;
    }

    .tp-freeship--cart {
        max-width: 100%;
        border-radius: 0;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }

    .tp-freeship--sticky {
        padding: 10px 15px;
    }

    .tp-freeship__countdown {
        flex-direction: column;
        gap: 4px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .tp-freeship__products-list {
        gap: 8px;
    }

    .tp-freeship__product {
        width: 90px;
        padding: 8px;
    }

    .tp-freeship__product-img {
        width: 45px;
        height: 45px;
    }

    .tp-freeship__product-name {
        font-size: 10px;
    }

    .tp-freeship__coupon {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ===== Small Mobile ===== */
@media (max-width: 480px) {
    .tp-freeship__products-list {
        justify-content: space-around;
    }

    .tp-freeship__product {
        width: calc(33% - 8px);
        min-width: 80px;
    }
}

/* ===== Urgency Timer (NEU v3.0) ===== */
.tp-freeship__urgency {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.tp-freeship__urgency--today {
    background: linear-gradient(90deg, #ff9800, #f57c00);
    color: #fff;
    animation: tp-urgency-pulse 2s ease-in-out infinite;
}

.tp-freeship__urgency--tomorrow {
    background: #e3f2fd;
    color: #1565c0;
}

.tp-freeship__urgency-icon {
    font-size: 16px;
}

.tp-freeship__urgency-text strong {
    color: inherit;
    font-weight: 700;
}

@keyframes tp-urgency-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ===== Social Proof (NEU v3.0) ===== */
.tp-freeship__social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 14px;
    background: #e8f5e9;
    border-radius: 4px;
    font-size: 12px;
    color: #2e7d32;
}

.tp-freeship__social-icon {
    font-size: 14px;
}

.tp-freeship__social-text strong {
    color: #1b5e20;
    font-weight: 700;
}

/* ===== Konfetti Container (NEU v3.0) ===== */
.tp-freeship-confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
    overflow: hidden;
}

.tp-freeship-confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: tp-confetti-fall 3s ease-out forwards;
}

.tp-freeship-confetti-piece--light .tp-freeship-confetti-piece {
    width: 8px;
    height: 8px;
}

.tp-freeship-confetti-piece--heavy .tp-freeship-confetti-piece {
    width: 12px;
    height: 12px;
}

@keyframes tp-confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Konfetti Farben */
.tp-freeship-confetti-piece:nth-child(6n+1) { background: #ff6b6b; }
.tp-freeship-confetti-piece:nth-child(6n+2) { background: #feca57; }
.tp-freeship-confetti-piece:nth-child(6n+3) { background: #4ecdc4; }
.tp-freeship-confetti-piece:nth-child(6n+4) { background: #a55eea; }
.tp-freeship-confetti-piece:nth-child(6n+5) { background: #26de81; }
.tp-freeship-confetti-piece:nth-child(6n+6) { background: #fd79a8; }

/* Konfetti Formen */
.tp-freeship-confetti-piece:nth-child(odd) {
    border-radius: 50%;
}

.tp-freeship-confetti-piece:nth-child(3n) {
    border-radius: 0;
    transform: rotate(45deg);
}

/* ===== Erfolgs-Animation (NEU v3.0) ===== */
.tp-freeship--complete.tp-freeship--just-completed {
    animation: tp-success-bounce 0.6s ease-out;
}

@keyframes tp-success-bounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.05); }
    50% { transform: scale(0.98); }
    70% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.tp-freeship--complete .tp-freeship__text {
    animation: tp-success-text 0.5s ease-out;
}

@keyframes tp-success-text {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive fuer neue Features ===== */
@media (max-width: 767px) {
    .tp-freeship__urgency {
        padding: 6px 10px;
        font-size: 12px;
        flex-wrap: wrap;
    }

    .tp-freeship__social {
        padding: 6px 10px;
        font-size: 11px;
    }

    .tp-freeship-confetti-piece {
        width: 8px;
        height: 8px;
    }
}
