/* Vendor Rating System Styles */
.vendor-rating-container {
    position: relative;
    display: inline-block;
    transition: all 0.2s ease-in-out;
}

.vendor-rating-container:hover {
    border-color: #007cba;
}

.vendor-rating-container.popup-open {
    border-color: #28a745;
}

.star-rating {
    position: relative;
    display: inline-block;
}

.star-rating .star {
    font-size: 30px;
    color: #ccc;
    cursor: pointer;
    transition: color 0.15s ease-in-out;
    position: relative;
}

.star-rating .star.filled {
    color: gold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.star-rating .rating-number {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #333;
    font-weight: bold;
    min-width: 12px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.star-rating .rating-number:not(:empty) {
    opacity: 1;
}

/* Mobile stars - hidden by default on desktop */
.star-rating .mobile-stars {
    display: none;
}

.rating-popover {
    position: absolute;
    top: 50px;
    left: -85px;
    background: white;
    border: 2px solid #333;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: none;
    z-index: 99999;
    min-width: 200px;
    overflow: visible;
}

.rating-popover.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.rating-popover .popover-stars {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.rating-popover .popover-stars span {
    font-size: 24px;
    cursor: pointer;
    color: #ccc;
    padding: 4px;
    transition: color 0.15s ease-in-out;
    user-select: none;
    border-radius: 3px;
}

.rating-popover .popover-stars span:hover {
    color: gold;
}

.rating-popover .popover-stars span.hover,
.rating-popover .popover-stars span.selected {
    color: gold;
}

.rating-popover .popover-stars span.selected {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Ensure table cells don't clip the popup */
td {
    position: relative;
    overflow: visible;
}

/* Ensure table doesn't clip the popup */
table {
    overflow: visible;
}

/* Ensure any parent containers don't clip the popup */
.vendor-rating-container * {
    overflow: visible;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .rating-popover {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 1000000;
        max-width: 90vw;
        min-width: 200px;
    }
    
    .rating-popover .popover-stars span {
        font-size: 28px;
        padding: 6px;
    }
}

/* Mobile inline rating system (767px and below) */
@media (max-width: 767px) {
    /* Hide the single star and popup system on mobile */
    .star-rating .star,
    .star-rating .rating-number,
    .rating-popover {
        display: none !important;
    }
    
    /* Show the mobile inline stars */
    .star-rating .mobile-stars {
        display: flex !important;
        gap: 8px;
        align-items: center;
    }
    
    .star-rating .mobile-stars span {
        font-size: 32px;
        color: #ccc;
        cursor: pointer;
        transition: color 0.15s ease-in-out;
        user-select: none;
        padding: 4px;
    }
    
    .star-rating .mobile-stars span:hover {
        color: gold;
    }
    
    .star-rating .mobile-stars span.filled {
        color: gold;
        text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    }
    
    .star-rating .mobile-stars span.hover {
        color: gold;
    }
    
    /* Info icon styling */
    .rating-info-icon {
        display: inline-block;
        margin-left: 8px;
        color: #000000;
        cursor: help;
        font-size: 16px;
    }
    
    .rating-info-icon:hover {
        color: #333333;
    }
}

/* Custom tooltip for rating system */
.rating-tooltip-trigger {
    position: relative;
    display: inline-block;
    cursor: help;
}

.rating-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    max-width: 300px;
    white-space: normal;
    line-height: 1.4;
}

.rating-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #333;
}

/* Desktop positioning - to the right of the header, moved down 100px and left 150px */
@media (min-width: 768px) {
    .rating-tooltip {
        top: calc(50% + 100px);
        left: calc(100% - 150px);
        transform: translateY(-50%);
        margin-left: 8px;
    }
    
    .rating-tooltip::after {
        top: 50%;
        left: -6px;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-right-color: #333;
    }
}

/* Mobile positioning - below the icon */
@media (max-width: 767px) {
    .rating-tooltip {
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 8px;
    }
    
    .rating-tooltip::after {
        top: -6px;
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-bottom-color: #333;
    }
}

/* User-specific vendor rating styles */
.vendor-rating-label {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.vendor-rating-stars {
    display: flex;
    gap: 4px;
    align-items: center;
}

.vendor-rating-stars .star {
    font-size: 20px;
    color: #ccc;
    cursor: pointer;
    transition: color 0.15s ease-in-out;
    user-select: none;
}

.vendor-rating-stars .star:hover,
.vendor-rating-stars .star.hover {
    color: gold;
}

.vendor-rating-stars .star.filled {
    color: gold;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.vendor-rating-stars.loading {
    opacity: 0.7;
    pointer-events: none;
}

.info-icon-wrapper {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.vendor-rating-info {
    color: #000000;
    cursor: help;
    font-size: 14px;
}

.vendor-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    max-width: 400px;
    min-width: 250px;
    white-space: normal;
    line-height: 1.4;
    display: none;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
}

.vendor-tooltip.show {
    display: block;
}

.vendor-tooltip::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #333;
}

.rating-feedback {
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.rating-feedback.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.rating-feedback.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .vendor-rating-stars .star {
        font-size: 24px;
    }
    
    .vendor-rating-label {
        font-size: 16px;
    }
    
    /* Custom mobile tooltip positioning */
    .vendor-tooltip {
        position: absolute;
        top: calc(100% - 110px);
        left: -240px;
        transform: none;
        margin-top: 8px;
        margin-left: 0;
    }
    
    .vendor-tooltip::after {
        top: -6px;
        left: 20px;
        transform: none;
        border: 6px solid transparent;
        border-bottom-color: #333;
    }
}
