/* ==========================================================================
   GARAN label – frontend
   Colours follow Implementing Regulation (EU) 2025/1960:
   blue #003399, yellow #FFED00, black, white
   ========================================================================== */

:root {
    --fwpv-garan-blue: #003399;
    --fwpv-garan-yellow: #FFED00;
    --fwpv-garan-radius: 6px;
}

/* --------------------------------------------------------------------------
   Badge (nested presentation trigger)
   -------------------------------------------------------------------------- */

.fwpv-garan {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.fwpv-garan-badge {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 0;
    margin: 0;
    border: 2px solid var(--fwpv-garan-blue);
    border-radius: var(--fwpv-garan-radius);
    background: #fff;
    color: var(--fwpv-garan-blue);
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    box-shadow: none;
    overflow: hidden;
    transition: box-shadow .15s ease;
}

.fwpv-garan-badge:hover,
.fwpv-garan-badge:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 51, 153, .18);
    outline: none;
    background: #fff;
    color: var(--fwpv-garan-blue);
}

.fwpv-garan-badge-mark {
    background: var(--fwpv-garan-blue);
    color: #fff;
    padding: 6px 8px;
    font-size: 11px;
    letter-spacing: .08em;
    font-weight: 800;
}

.fwpv-garan-badge-years {
    background: var(--fwpv-garan-yellow);
    color: #000;
    padding: 4px 8px;
    font-size: 16px;
    font-weight: 800;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
}

.fwpv-garan-badge-text {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* inline variant (upsell lines, cart): smaller */
.fwpv-garan-inline .fwpv-garan-badge-mark {
    padding: 4px 6px;
    font-size: 9px;
}

.fwpv-garan-inline .fwpv-garan-badge-years {
    padding: 3px 6px;
    font-size: 13px;
}

.fwpv-garan-inline .fwpv-garan-badge-text {
    padding: 4px 8px;
    font-size: 11px;
}

/* block variant (product summary) */
.fwpv-garan-block {
    display: block;
}

.fwpv-garan-block .fwpv-garan-badge-years {
    font-size: 20px;
    padding: 4px 10px;
}

/* --------------------------------------------------------------------------
   Popover with full label
   -------------------------------------------------------------------------- */

.fwpv-garan-popover {
    position: absolute;
    z-index: 9999;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid #d9dbe3;
    border-radius: var(--fwpv-garan-radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    padding: 36px 16px 16px;
    text-align: left;
    line-height: 1.4;
    font-size: 13px;
    font-weight: 400;
    color: #222;
    display: block;
}

.fwpv-garan-popover[hidden] {
    display: none;
}

.fwpv-garan-popover.align-right {
    left: auto;
    right: 0;
}

.fwpv-garan-popover.align-center {
    left: 50%;
    transform: translateX(-50%);
}

.fwpv-garan-popover-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f0f1f4;
    color: #333;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.fwpv-garan-popover-close:hover {
    background: #e2e4ea;
    color: #000;
}

.fwpv-garan-full-image {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto 8px;
}

.fwpv-garan-conditions {
    margin: 8px 0 0;
    font-size: 12px;
}

.fwpv-garan-conditions a {
    color: var(--fwpv-garan-blue);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   HTML fallback rendering (only when no official graphic is uploaded)
   -------------------------------------------------------------------------- */

.fwpv-garan-card {
    border: 3px solid var(--fwpv-garan-blue);
    border-radius: 8px;
    background: #fff;
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    color: #000;
    overflow: hidden;
}

.fwpv-garan-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--fwpv-garan-blue);
    color: #fff;
    padding: 8px 14px;
}

.fwpv-garan-card-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .1em;
}

.fwpv-garan-card-check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--fwpv-garan-yellow);
    color: #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.fwpv-garan-card-years {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
}

.fwpv-garan-card-years-number {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    color: var(--fwpv-garan-blue);
}

.fwpv-garan-card-years-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.fwpv-garan-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 14px 12px;
    font-size: 12px;
}

.fwpv-garan-card-brand {
    font-weight: 700;
}

.fwpv-garan-card-foot {
    border-top: 1px solid #d9dbe3;
    padding: 10px 14px;
    font-size: 11px;
    line-height: 1.4;
    background: #f6f7fb;
}

/* --------------------------------------------------------------------------
   Legal guarantee notice
   -------------------------------------------------------------------------- */

.fwpv-garan-notice {
    display: block;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e3e5ea;
}

.fwpv-garan-notice-link {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--fwpv-garan-blue);
    text-decoration: underline;
    font-size: 12px;
    cursor: pointer;
    box-shadow: none;
}

.fwpv-garan-notice-link:hover {
    color: #001f66;
    background: none;
}

.fwpv-garan-notice-content {
    display: block;
    margin-top: 8px;
}

.fwpv-garan-notice-content[hidden] {
    display: none;
}

.fwpv-garan-notice-image {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 8px;
    border: 1px solid #d9dbe3;
}

.fwpv-garan-notice-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.fwpv-garan-notice-standalone {
    max-width: 640px;
    margin: 16px 0;
}

.fwpv-garan-notice-standalone .fwpv-garan-notice-text {
    font-size: 14px;
}

/* --------------------------------------------------------------------------
   Product page (fwpv summary + upsells, 50% column on desktop)
   -------------------------------------------------------------------------- */

.fwpv-garan-summary {
    margin: 12px 0 4px;
}

.fwpv-garan-summary .fwpv-label {
    margin-bottom: 6px;
}

.fwpv-garan-pending {
    margin: 8px 0;
    font-size: 13px;
    color: #555;
}

/* upsell lines: badge sits right of the title/price, wraps on narrow widths */
.fwpv-checkbox-selection-wrapper .fwpv-selection-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.fwpv-checkbox-selection-wrapper .fwpv-selection-label .fwpv-garan {
    margin-left: auto;
}

.fwpv-checkbox-selection-wrapper .fwpv-selection-label .fwpv-garan .fwpv-garan-badge-text {
    display: none;
}

@media (min-width: 1200px) {
    .fwpv-checkbox-selection-wrapper .fwpv-selection-label .fwpv-garan .fwpv-garan-badge-text {
        display: inline;
    }
}

/* popover inside the upsell list must escape overflow */
.fwpv-checkbox-selection-wrapper,
.fwpv-selection-wrapper {
    overflow: visible;
}

/* --------------------------------------------------------------------------
   Cart (classic): own column
   -------------------------------------------------------------------------- */

.fwpv-garan-cart-cell {
    display: block;
    margin-top: 6px;
}

table.shop_table.cart.fwpv-garan-has-column .product-garan {
    white-space: nowrap;
    vertical-align: middle;
}

table.shop_table.cart.fwpv-garan-has-column td.product-garan .fwpv-garan-cart-cell {
    margin-top: 0;
}

@media (max-width: 768px) {
    table.shop_table.cart.fwpv-garan-has-column td.product-garan:empty {
        display: none;
    }
    table.shop_table.cart.fwpv-garan-has-column td.product-garan .fwpv-garan {
        float: right;
    }
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
    .fwpv-garan-popover {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        width: auto;
        max-width: none;
        transform: none !important;
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
        overflow: auto;
    }
    .fwpv-garan-badge-text {
        white-space: normal;
    }
}

.fwpv-checkbox-selection-wrapper .fwpv-selection-label .fwpv-upsell-title {
    flex: 1 1 auto;
    min-width: 0;
}

.fwpv-garan-document {
    margin: 6px 0 0;
    font-size: 12px;
}

.fwpv-garan-document a {
    color: var(--fwpv-garan-blue);
    text-decoration: underline;
}
