/* Rating Styles for WP IB B Directory */

/* Star Rating Display */
.ib-star-rating {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 5px 0;
    white-space: nowrap;
}

.ib-star {
    font-size: 20px;
    color: #e0e0e0;
    display: inline-block;
    position: relative;
    line-height: 1;
}

.ib-star-full {
    color: #FBB202;
}

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

.ib-star-partial {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ib-star-empty {
    color: #e0e0e0;
}

.ib-rating-text {
    font-size: 14px;
    color: #666;
    margin-left: 8px;
}

/* Rating Form */
.ib-rating-form-container {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.ib-rating-form-container h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

/* Interactive Star Rating */
.ib-rating-stars {
    margin: 15px 0;
    line-height: 1;
}

.ib-star-input {
    font-size: 24px;
    color: #e0e0e0;
    cursor: pointer;
    transition: color 0.2s ease;
    margin-right: 4px;
    user-select: none;
    display: inline-block;
    vertical-align: top;
}

/* Remove any unwanted line breaks */
.ib-rating-stars br {
    display: none;
}

.ib-star-input:hover,
.ib-star-input.active {
    color: #FBB202;
}

.ib-star-input.hover {
    color: #FBB202;
}

/* Comment Section */
.ib-rating-comment {
    margin: 15px 0;
}

.ib-rating-comment label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.ib-rating-comment textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.ib-rating-comment textarea:focus {
    outline: none;
    border-color: #FBB202;
    box-shadow: 0 0 0 2px rgba(251, 178, 2, 0.2);
}

/* Submit Button */
.ib-submit-rating {
    background-color: #FBB202;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.ib-submit-rating:hover {
    background-color: #e09a00;
}

.ib-submit-rating:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Messages */
.ib-rating-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

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

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

/* Login Notice */
.ib-rating-login-notice {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

.ib-login-button {
    display: inline-block;
    background-color: #FBB202;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

.ib-login-button:hover {
    background-color: #e09a00;
    color: white;
    text-decoration: none;
}

/* Already Rated Notice */
.ib-rating-already-rated {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    color: #856404;
}

/* Ratings Summary */
.ib-ratings-summary {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.ib-ratings-summary h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.ib-rating-summary-text {
    margin: 10px 0 0 0;
    color: #666;
    font-size: 14px;
}

/* Individual Ratings List */
.ib-ratings-list {
    margin: 20px 0;
}

.ib-ratings-list h4 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.ib-rating-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.ib-rating-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.ib-rating-header p {
    margin: 0;
}

.ib-rating-header strong {
    color: #333;
}

.ib-rating-date {
    color: #999;
    font-size: 12px;
    margin-left: auto;
}

.ib-rating-comment {
    color: #555;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ib-rating-form-container {
        padding: 15px;
    }
    
    .ib-star-input {
        font-size: 20px;
        margin-right: 2px;
    }
    
    .ib-rating-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .ib-rating-date {
        margin-left: 0;
    }
}

/* Loading State */
.ib-rating-form.loading .ib-submit-rating {
    background-color: #ccc;
    cursor: not-allowed;
}

.ib-rating-form.loading .ib-submit-rating:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: ib-spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes ib-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Accessibility */
.ib-star-input:focus {
    outline: 2px solid #FBB202;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ib-star-full {
        color: #000;
    }
    
    .ib-star-empty {
        color: #666;
    }
}

/* AJAX Loading States */
.ib-ratings-loading {
    min-height: 100px;
    position: relative;
}

.ib-ratings-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.ib-ratings-loader p {
    color: #666;
    font-style: italic;
    margin: 0;
}

.ib-ratings-loader::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #ddd;
    border-radius: 50%;
    border-top-color: #FBB202;
    animation: ib-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

.ib-ratings-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

/* Rating Delete Button */
.ib-delete-rating-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 10px;
    border-radius: 3px;
    transition: color 0.2s ease, background-color 0.2s ease;
    line-height: 1;
}

.ib-delete-rating-btn:hover {
    color: #d63638;
    background-color: #f0f0f0;
}

.ib-delete-rating-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ib-rating-delete-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
}