/* Star Rating Component */
.star-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 16px;
    line-height: 1;
    flex-wrap: nowrap;
}

.star-rating .star {
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: inherit;
    line-height: 1;
    vertical-align: middle;
    box-sizing: border-box;
    width: 1em;
    height: 1em;
}

.star-rating .star.active {
    color: #ffc107;
}

.star-rating .star.half {
    background: linear-gradient(90deg, #ffc107 50%, #ddd 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.star-rating .star:hover {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.05);
    border-radius: 2px;
}

/* Half-star hover effect */
.star-rating .star:hover.half {
    color: #ddd;
}

.star-rating .star:hover.half::before {
    color: #ffc107;
}

/* Visual hint for half-star clicking */
.star-rating:not(.readonly) .star::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    width: 1px;
    height: 80%;
    background: rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    transform: translateX(-50%);
}

.star-rating:not(.readonly) .star:hover::after {
    opacity: 0.4;
}

/* Tooltip styles */
.star-rating-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
    transform: translateX(-50%);
}

.star-rating-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

.star-rating.readonly .star {
    cursor: default;
}

.star-rating-label {
    margin-left: 8px;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    line-height: 1;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .star-rating {
        font-size: 16px;
        gap: 3px;
        align-items: center;
        padding: 4px 0;
        display: flex;
        flex-wrap: nowrap;
    }
    
    .star-rating .star {
        /* Touch-friendly but not too large */
        min-height: 32px !important;
        min-width: 32px !important;
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        margin: 0 1px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
        vertical-align: middle !important;
        border-radius: 4px !important;
        position: relative;
        font-size: 20px !important;
        cursor: pointer;
        background: rgba(0, 0, 0, 0.03);
        transition: all 0.15s ease;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        box-sizing: border-box;
    }
    
    .star-rating .star:hover,
    .star-rating .star:active {
        background: rgba(255, 193, 7, 0.15);
        transform: scale(1.05);
    }
    
    .star-rating .star.active {
        background: rgba(255, 193, 7, 0.1);
    }
    
    .star-rating .star.half {
        background: linear-gradient(90deg, #ffc107 50%, #ddd 50%) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
    }
    
    .star-rating-label {
        font-size: 12px;
        margin-left: 6px;
        line-height: 1;
        vertical-align: middle;
        font-weight: 500;
        white-space: nowrap;
    }
    
    .star-rating-clear {
        line-height: 1 !important;
        vertical-align: middle !important;
        font-size: 16px;
        min-height: 32px !important;
        min-width: 32px !important;
        width: 32px !important;
        height: 32px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 4px !important;
        background: rgba(220, 53, 69, 0.08) !important;
        color: #dc3545 !important;
        margin-right: 6px !important;
        padding: 0 !important;
        transition: all 0.15s ease !important;
        border: none !important;
    }
    
    .star-rating-clear:hover {
        background: rgba(220, 53, 69, 0.15) !important;
        transform: scale(1.05);
    }
}

/* Detail modal mobile-friendly styles */
@media (max-width: 768px) {
    .modal-xl {
        margin: 0.5rem;
    }
    
    .modal-xl .modal-dialog {
        max-width: none;
        margin: 0;
    }
    
    .modal-xl .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-xl .modal-body {
        padding: 1rem;
    }
    
    .detail-section .row {
        margin: 0;
    }
    
    .detail-section .col-md-6,
    .detail-section .col-md-4,
    .detail-section .col-md-8,
    .detail-section .col-md-12 {
        padding: 0.25rem;
    }
    
    .detail-item {
        margin-bottom: 0.75rem;
        font-size: 14px;
    }
    
    .detail-item i {
        font-size: 16px;
        width: 18px;
        margin-right: 0.5rem;
    }
    
    .detail-item small {
        font-size: 11px;
    }
    
    .badge {
        font-size: 10px;
        padding: 0.25em 0.5em;
        margin: 0.125rem;
    }
    
    #detailPhoto {
        max-height: 200px;
        margin-bottom: 1rem;
    }
    
    #detailName {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
}

/* Language rating display in detail */
.language-rating {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.language-rating .language-name {
    font-weight: 500;
    min-width: 80px;
}

.language-rating .stars {
    display: flex;
    gap: 1px;
}

.language-rating .star {
    color: #ffc107;
    font-size: 14px;
}

.language-rating .star.empty {
    color: #ddd;
}

@media (max-width: 768px) {
    .language-rating {
        font-size: 12px;
    }
    
    .language-rating .language-name {
        min-width: 70px;
        font-size: 11px;
    }
    
    .language-rating .star {
        font-size: 12px;
    }
}
