/**
 * TCM JIN Cart – Styles for the [tcm_jin_cart] shortcode.
 * Dosen-Select ÜBER einem vollbreiten Add-to-Cart-Button + zentrierter "Zum Produkt"-Link.
 * Button-Farbe = Flatsome-Primary (#177e89).
 */
.jin-cart {
    max-width: 600px;
    margin: 0 0 8px;
}

/* --- Mengen-Auswahl (modernes Select) --- */
.jin-cart__qty {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    font-size: 0.95em;
}

.jin-cart__qty-label {
    font-weight: 600;
    white-space: nowrap;
    color: #333;
}

.jin-cart__select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    min-width: 140px;
    padding: 12px 42px 12px 16px;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.2;
    color: #222;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jin-cart__select:hover {
    border-color: #177e89;
}

.jin-cart__select:focus {
    outline: none;
    border-color: #177e89;
    box-shadow: 0 0 0 3px rgba(23, 126, 137, 0.18);
}

.jin-cart__price {
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 1.1em;
    color: #177e89;
    white-space: nowrap;
}

/* --- Info-Icon (schwarzer Kreis, weißes "i") + Tooltip --- */
.jin-cart__info {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1;
    cursor: help;
    user-select: none;
}

.jin-cart__info::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: max-content;
    max-width: 280px;
    padding: 10px 14px;
    background: #2c2c2c;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 30;
    pointer-events: none;
}

/* Sichtbar via Tastatur-Fokus (a11y) oder per JS-Tap-Toggle (.is-open, Touch). */
.jin-cart__info:focus-visible::after,
.jin-cart__info.is-open::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Hover nur auf echten Hover-Geräten (Desktop). Auf Touch würde ein klebender
   :hover den Tooltip offen halten und so das Wieder-Ausblenden beim zweiten
   Tipp (.is-open wird entfernt) verhindern. */
@media (hover: hover) {
    .jin-cart__info:hover::after {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* --- Add-to-Cart-Button (Flatsome-Primary) --- */
.jin-cart__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 18px;
    border: 0;
    border-radius: 6px;
    background: #177e89;
    color: #fff;
    font-size: 1.05em;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.18s ease, opacity 0.18s ease;
}

.jin-cart__btn:hover {
    background: #126570;
}

.jin-cart__btn[disabled],
.jin-cart__btn.is-loading {
    opacity: 0.6;
    cursor: default;
}

.jin-cart__btn-icon {
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 18c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM7.2 14.6l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.86-7.01-1.74-.96-3.87 7.01H8.53L4.27 2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7.42c-.13 0-.23-.1-.22-.4z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 18c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM7.2 14.6l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.86-7.01-1.74-.96-3.87 7.01H8.53L4.27 2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7.42c-.13 0-.23-.1-.22-.4z'/></svg>") center / contain no-repeat;
    flex: 0 0 auto;
}

/* --- Status-Meldung --- */
.jin-cart__msg {
    min-height: 1.2em;
    margin: 8px 0 0;
    font-size: 0.9em;
    text-align: center;
}

.jin-cart__msg.is-ok { color: #177e89; }
.jin-cart__msg.is-error { color: #b3261e; }
.jin-cart__msg.is-info { color: #666; }
.jin-cart__msg .jin-cart__cartlink { text-decoration: underline; }

/* --- "Zum Produkt"-Link (zentriert) --- */
.jin-cart__link {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 0.85em;
    color: #777;
    text-decoration: underline;
}

@media (max-width: 549px) {
    /* Zeile NICHT umbrechen: das Select darf schrumpfen, damit Preis + Info-Icon
       (wie auf Desktop) am rechten Rand bleiben. Dann öffnet der Tooltip über die
       Basis-Regel (right:0) nach links, bleibt im Viewport UND sitzt direkt über dem
       „i" — kein Zentrieren (würde bei kurzen Preisen links überlaufen), kein Umbruch
       (rückte das „i" in die Zeilenmitte, dadurch saß der Tooltip zu weit weg).
       Kompaktere Gaps + schlankeres Select-Padding, damit die Zeile bis ~320px passt
       (deckt alle gängigen Phones inkl. 360px-Android ab) und „3 Dosen" lesbar bleibt. */
    .jin-cart__qty { flex-wrap: nowrap; gap: 8px; }
    .jin-cart__select {
        min-width: 0;
        padding-left: 12px;
        padding-right: 30px;
        background-position: right 10px center;
    }
    .jin-cart__info::after { max-width: 84vw; }
}
