.company-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    position: relative;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* =========================
   КНОПКИ
========================= */

.company-rating button {
    appearance: none;
    border: none;
    cursor: pointer;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    transition: 
        transform .15s ease,
        box-shadow .15s ease,
        background .2s ease,
        color .2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Залишити відгук — головна кнопка */
.company-rating .add-review-btn {
    background: linear-gradient(135deg, #314B75, #4B6FB3);
    color: #fff;
    box-shadow: 0 4px 12px rgba(49, 75, 117, 0.25);
}

.company-rating .add-review-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(49, 75, 117, 0.35);
}

.company-rating .add-review-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(49, 75, 117, 0.3);
}

/* Відгуки — другорядна */
.company-rating .reviews-btn {
    background: #f2f5fb;
    color: #314B75;
    border: 1px solid rgba(49, 75, 117, 0.2);
}

.company-rating .reviews-btn:hover {
    background: #e6ecf7;
    transform: translateY(-1px);
}

.company-rating .reviews-btn:active {
    transform: translateY(0);
}

/* =========================
   РЕЙТИНГ / БАЛИ
========================= */

.company-rating .rating-points {
    font-weight: 700;
    color: #314B75;
    min-width: 28px;
    text-align: right;
}

/* =========================
   ЗІРКИ
========================= */

.company-rating .stars {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.company-rating .star {
    width: 20px;
    height: 20px;
    transition: transform .15s ease, opacity .15s ease;
}

.company-rating .star.filled {
    filter: drop-shadow(0 1px 2px rgba(255, 180, 0, .6));
}

.company-rating .stars:hover .star {
    transform: scale(1.08);
}

.company-rating .star.empty {
    opacity: .35;
}

/* =========================
   ВІДГУКИ (ACCORDION)
========================= */

.reviews-accordion {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 
        0 10px 25px rgba(0,0,0,.12),
        0 2px 6px rgba(0,0,0,.08);
    z-index: 100;
    display: none;
    max-height: 240px;
    overflow-y: auto;
    animation: fadeSlide .2s ease;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.review-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: #f7f9fc;
    font-size: 13px;
}

.review-item:not(:last-child) {
    margin-bottom: 8px;
}

/* =========================
   REVIEW POPUP
========================= */

.review-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    backdrop-filter: blur(2px);
    z-index: 99998;
}

.review-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 14px;
    padding: 20px 18px 18px;
    width: 100%;
    max-width: 360px;
    z-index: 99999;
    box-shadow:
        0 20px 40px rgba(0,0,0,.2),
        0 5px 10px rgba(0,0,0,.12);
    animation: popupScale .2s ease;
}

@keyframes popupScale {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.review-popup h3 {
    margin: 0 0 14px;
    font-size: 16px;
    color: #314B75;
    text-align: center;
}

.review-popup input,
.review-popup textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #d7deea;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 10px;
    font-family: inherit;
}

.review-popup textarea {
    resize: vertical;
    min-height: 70px;
}

.review-popup input:focus,
.review-popup textarea:focus {
    outline: none;
    border-color: #4B6FB3;
}

/* 👍 👎 */
.review-votes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 6px 0 12px;
}

.review-votes button {
    font-size: 18px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f2f5fb;
    border: 1px solid rgba(49,75,117,.2);
}

/* 👍 👎 активний стан */
.review-votes button {
    font-size: 18px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f2f5fb;
    border: 1px solid rgba(49,75,117,.2);
    transition: background .2s ease, color .2s ease, transform .15s ease;
}

.review-votes button:hover {
    transform: scale(1.05);
}

.review-votes button.active.like {
    background: #e6f4ea;
    color: #1e7f43;
    border-color: #9fd3b4;
}

.review-votes button.active.dislike {
    background: #fdeaea;
    color: #b3261e;
    border-color: #f1b5b5;
}

/* Дії */
.review-actions {
    display: flex;
    gap: 8px;
}

.review-actions button {
    flex: 1;
    border-radius: 999px;
    padding: 7px 0;
    font-size: 13px;
    font-weight: 600;
}

.review-actions .submit-review {
    background: linear-gradient(135deg, #314B75, #4B6FB3);
    color: #fff;
}

.review-actions .close-popup {
    background: #f2f5fb;
    color: #314B75;
    border: 1px solid rgba(49,75,117,.2);
}

/* =========================
   POPUP CLOSE (X)
========================= */

.review-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    color: #314B75;
    opacity: .6;
    transition: opacity .2s ease, transform .2s ease;
}

.review-popup-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* =========================
   TOAST
========================= */

.company-rating-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #314B75;
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    z-index: 100000;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    animation: toastFade .2s ease;
}

@keyframes toastFade {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* =========================
   КАРТКИ — Z-INDEX ДЛЯ ВІДГУКІВ
========================= */

.bizinfo-company-card {
    position: relative;
    z-index: 2;
}

.bizinfo-company-card.has-open-reviews {
    z-index: 5;
}

@media (max-width: 600px) {

    /* =========================
       КОНТЕЙНЕР РЕЙТИНГУ
    ========================= */

    .company-rating {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* кнопки в 2 рядки */
    .company-rating .add-review-btn,
    .company-rating .reviews-btn {
        flex: 1 1 100%;
        justify-content: center;
    }

    /* рейтинг + зірки в один ряд */
    .company-rating .rating-points {
        order: 3;
        min-width: auto;
    }

    .company-rating .stars {
        order: 4;
    }

    /* =========================
       ACCORDION
    ========================= */

    .reviews-accordion {
        position: static;
        width: 100%;
        margin-top: 8px;
        max-height: 220px;
    }

    /* =========================
       POPUP
    ========================= */

    .review-popup {
        width: calc(100% - 24px);
        max-width: none;
        padding: 16px 14px 14px;
    }

    .review-popup h3 {
        font-size: 15px;
    }

    /* кнопки 👍 👎 */
    .review-votes {
        gap: 6px;
    }

    .review-votes button {
        flex: 1;
    }

    /* submit / close */
    .review-actions {
        flex-direction: column;
    }

    .review-actions button {
        width: 100%;
    }

    /* =========================
       TOAST
    ========================= */

    .company-rating-toast {
        width: calc(100% - 32px);
        text-align: center;
        font-size: 13px;
    }
}
