/* ================================================================
   Trust Badge – Float Widget
   Brand: #023D5B (plava) · #728D6A (zelena) · #f59e0b (zvjezdice)
   Pozicija: fiksiran, donji desni ugao
   ================================================================ */

/* ---- Root varijable za laku izmjenu ---- */
:root {
    --tb-blue:        #023D5B;
    --tb-blue-mid:    #034e75;
    --tb-green:       #728D6A;
    --tb-gold:        #f59e0b;
    --tb-gold-light:  #fbbf24;
    --tb-white:       #ffffff;
    --tb-radius:      16px;
    --tb-shadow:
        0 8px 32px rgba(2, 61, 91, .22),
        0 2px 8px  rgba(2, 61, 91, .12);
    --tb-shadow-hover:
        0 20px 56px rgba(2, 61, 91, .30),
        0 4px 16px  rgba(2, 61, 91, .16);
}

/* ================================================================
   WRAPPER – fiksiran na ekranu
   ================================================================ */
#rev-trust-badge {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9990;

    /* Ulazna animacija */
    opacity: 0;
    transform: translateY(24px) scale(0.95);
    animation: tb-enter .55s cubic-bezier(0.34, 1.36, 0.64, 1) .6s forwards;

    /* Pointer events – aktivan samo kad je vidljiv */
    pointer-events: none;
}

#rev-trust-badge.tb-visible {
    pointer-events: auto;
}

@keyframes tb-enter {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#rev-trust-badge.tb-hidden {
    animation: none;
    opacity: 0;
    transform: translateY(24px) scale(0.95);
    pointer-events: none;
    transition: opacity .3s, transform .3s;
}

/* ================================================================
   KARTICA
   ================================================================ */
.tb-card {
    position: relative;
    background: var(--tb-white);
    border-radius: var(--tb-radius);
    box-shadow: var(--tb-shadow);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .25s, transform .2s;
    user-select: none;
    -webkit-user-select: none;

    /* Lijeva akcent linija */
    border-left: 4px solid transparent;
    border-image: linear-gradient(180deg, var(--tb-blue) 0%, var(--tb-green) 100%) 1;
}

.tb-card:hover {
    box-shadow: var(--tb-shadow-hover);
    transform: translateY(-3px);
}

.tb-card:active {
    transform: translateY(-1px);
    box-shadow: var(--tb-shadow);
}

/* ================================================================
   KOMPAKTNI PRIKAZ (default – mali badge)
   ================================================================ */
.tb-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 12px 14px;
    min-width: 200px;
}

/* Ikona/avatar dio */
.tb-icon-wrap {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.tb-icon-bg {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tb-blue) 0%, var(--tb-blue-mid) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(2, 61, 91, .30);
}

/* Zeleni verified dot */
.tb-verified-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--tb-green);
    border-radius: 50%;
    border: 2px solid var(--tb-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    color: #fff;
    line-height: 1;
}

/* Tekst dio */
.tb-text {
    flex: 1;
    min-width: 0;
}

.tb-score {
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1;
    margin-bottom: 3px;
}

.tb-score-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--tb-blue);
    letter-spacing: -.02em;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1;
}

.tb-score-max {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    align-self: flex-end;
    margin-bottom: 1px;
}

.tb-stars-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
}

.tb-stars {
    display: flex;
    gap: 1.5px;
    line-height: 1;
}

.tb-star {
    font-size: 12px;
    color: #e2e8f0;
    transition: color .15s;
}

.tb-star.filled {
    color: var(--tb-gold);
}

.tb-star.half {
    /* Half star using clip-path */
    position: relative;
    color: #e2e8f0;
}

.tb-star.half::before {
    content: '★';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--tb-gold);
    width: 50%;
    overflow: hidden;
    display: inline-block;
}

.tb-count {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
}

.tb-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-top: 1px;
}

/* ================================================================
   PROŠIRENI PRIKAZ (expand on hover/click na desktop)
   ================================================================ */
.tb-expanded {
    display: none;
    padding: 18px 20px 16px;
    min-width: 260px;
    max-width: 300px;
}

.tb-exp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.tb-exp-score-big {
    font-size: 40px;
    font-weight: 900;
    color: var(--tb-blue);
    letter-spacing: -.03em;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1;
}

.tb-exp-meta {
    flex: 1;
}

.tb-exp-stars {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
}

.tb-exp-star {
    font-size: 16px;
    color: #e2e8f0;
}

.tb-exp-star.filled {
    color: var(--tb-gold);
}

.tb-exp-star.half {
    position: relative;
    color: #e2e8f0;
}

.tb-exp-star.half::before {
    content: '★';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--tb-gold);
    width: 50%;
    overflow: hidden;
    display: inline-block;
}

.tb-exp-count-text {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* Rating bars */
.tb-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.tb-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tb-bar-label {
    font-size: 11px;
    color: #64748b;
    width: 14px;
    text-align: right;
    flex-shrink: 0;
    font-weight: 600;
}

.tb-bar-label-star {
    font-size: 10px;
    color: var(--tb-gold);
}

.tb-bar-track {
    flex: 1;
    height: 6px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
}

.tb-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--tb-green) 0%, var(--tb-gold) 100%);
    width: 0;
    transition: width .8s cubic-bezier(0.34, 1.1, 0.64, 1);
}

.tb-bar-pct {
    font-size: 10px;
    color: #94a3b8;
    width: 26px;
    text-align: right;
    flex-shrink: 0;
    font-weight: 500;
}

/* CTA */
.tb-exp-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--tb-blue) 0%, var(--tb-blue-mid) 100%);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    transition: filter .2s, transform .15s, box-shadow .2s;
    box-shadow: 0 3px 12px rgba(2, 61, 91, .28);
    border: none;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

.tb-exp-cta:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(2, 61, 91, .34);
    color: #fff !important;
}

/* Verified footer */
.tb-exp-verified {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
}

.tb-exp-verified-icon {
    color: var(--tb-green);
    font-size: 12px;
}

/* ================================================================
   ZATVORI dugme
   ================================================================ */
.tb-dismiss {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    transition: background .15s, color .15s;
    z-index: 2;
    opacity: 0;
    transition: opacity .2s, background .15s, color .15s;
}

#rev-trust-badge:hover .tb-dismiss {
    opacity: 1;
}

.tb-dismiss:hover {
    background: #f1f5f9;
    color: var(--tb-blue);
}

/* ================================================================
   STANJA – expand
   ================================================================ */
#rev-trust-badge.tb-expanded-state .tb-compact {
    display: none;
}

#rev-trust-badge.tb-expanded-state .tb-expanded {
    display: block;
}

/* Pulse animacija na zvjezdici (privlači pažnju) */
@keyframes tb-pulse-star {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.15); }
}

.tb-icon-bg {
    animation: tb-pulse-star 3s ease-in-out 2s 3;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tablet */
@media (max-width: 768px) {
    #rev-trust-badge {
        bottom: 20px;
        right: 16px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    #rev-trust-badge {
        bottom: 16px;
        right: 12px;
        left: 12px; /* stretch to fit */
    }

    .tb-card {
        border-radius: 14px;
    }

    .tb-compact {
        min-width: unset;
        width: 100%;
    }

    /* Na mobilnom – expanded je puni width, bez hover logike */
    #rev-trust-badge.tb-expanded-state .tb-expanded {
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
}

/* Pozicija: lijevi ugao */
#rev-trust-badge[style*="left:28px"],
#rev-trust-badge[style*="left: 28px"] {
    right: auto;
}

@media (max-width: 480px) {
    #rev-trust-badge[style*="left:"] {
        left: 12px !important;
        right: 12px !important;
    }
}

/* Ako ima WooCommerce sticky bar ili slično – pomjeri gore */
.woocommerce-store-notice ~ * #rev-trust-badge,
.admin-bar #rev-trust-badge {
    bottom: 60px;
}
