/**
 * Multi Directory - Ratings & Feedback Styles
 * 
 * Compatible with:
 * - Desktop browsers
 * - AppPresser mobile apps
 * - Beaver Builder
 */

/* ============================================
   STAR RATING WIDGET
   ============================================ */

.directory-rating-widget {
    margin: 20px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.directory-rating-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* Star Display */
.directory-rating-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.directory-rating-number {
    font-size: 42px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.directory-rating-stars {
    color: #ffb900;
    font-size: 24px;
}

.directory-rating-count {
    color: #666;
    font-size: 14px;
}

/* Interactive Stars */
.directory-star-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}

.directory-star-rating .star {
    font-size: 36px;
    cursor: pointer;
    color: #ddd;
    transition: all 0.15s ease;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.directory-star-rating .star:hover,
.directory-star-rating .star.hover {
    color: #ffb900;
    transform: scale(1.15);
}

.directory-star-rating .star.selected {
    color: #ffb900;
}

.directory-star-rating.voted .star {
    cursor: default;
}

.directory-star-rating.voted .star:hover {
    transform: none;
}

.directory-star-rating.voting .star {
    opacity: 0.6;
    pointer-events: none;
}

/* Read-only inline display */
.directory-rating-display-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.directory-rating-display-inline .stars {
    color: #ffb900;
}

/* ============================================
   FEEDBACK WIDGET
   ============================================ */

.directory-feedback-widget {
    margin: 20px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.directory-feedback-title {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* Feedback Options Grid */
.directory-feedback-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.feedback-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.feedback-option .icon {
    font-size: 18px;
    line-height: 1;
}

.feedback-option .label {
    white-space: nowrap;
}

.feedback-option .vote-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    min-width: 24px;
    text-align: center;
}

/* Hover State */
.feedback-option:hover {
    border-color: #0073aa;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

/* Selected State */
.feedback-option.selected {
    border-color: #0073aa;
    background: #0073aa;
    color: white;
}

.feedback-option.selected .vote-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Voted State */
.feedback-option.voted {
    border-color: #28a745;
    background: #e8f5e9;
    color: #28a745;
    cursor: default;
}

.feedback-option.voted .vote-count {
    background: #28a745;
    color: white;
}

.feedback-option.voted:hover {
    transform: none;
    box-shadow: none;
}

/* Submit Button */
.directory-feedback-submit {
    margin-top: 20px;
}

.directory-feedback-submit button {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: white;
    border: none;
    padding: 14px 35px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.directory-feedback-submit button:hover {
    background: linear-gradient(135deg, #005177 0%, #003d5c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4);
}

.directory-feedback-submit button:active {
    transform: translateY(0);
}

.directory-feedback-submit button:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ============================================
   FEEDBACK DISPLAY (Read-only)
   ============================================ */

.directory-feedback-display {
    margin: 20px 0;
}

.feedback-item {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 12px 16px;
    background: #f9f9f9;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.feedback-item:hover {
    background: #f0f0f0;
}

.feedback-item .icon {
    font-size: 22px;
    margin-right: 12px;
    flex-shrink: 0;
}

.feedback-item .label {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.feedback-item .count {
    font-weight: 700;
    color: #0073aa;
    font-size: 15px;
    margin-right: 12px;
    min-width: 30px;
    text-align: right;
}

.feedback-item .bar {
    width: 100px;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
}

.feedback-item .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa 0%, #00a0d2 100%);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* ============================================
   MESSAGE NOTIFICATIONS
   ============================================ */

.directory-rating-message,
.directory-feedback-message {
    margin-top: 15px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 768px) {
    .directory-rating-widget,
    .directory-feedback-widget {
        padding: 20px 15px;
        margin: 15px 0;
    }
    
    .directory-rating-number {
        font-size: 36px;
    }
    
    .directory-star-rating .star {
        font-size: 32px;
    }
    
    .directory-feedback-options {
        flex-direction: column;
    }
    
    .feedback-option {
        width: 100%;
        justify-content: space-between;
    }
    
    .feedback-item {
        flex-wrap: wrap;
    }
    
    .feedback-item .bar {
        width: 100%;
        margin-top: 8px;
    }
    
    .directory-feedback-submit button {
        width: 100%;
    }
}

/* ============================================
   APPPRESSER MOBILE APP STYLES
   ============================================ */

body.in-apppresser-ratings .directory-rating-widget,
body.in-apppresser-ratings .directory-feedback-widget {
    border-radius: 8px;
    box-shadow: none;
    border: 1px solid #ddd;
}

body.in-apppresser-ratings .directory-star-rating .star {
    font-size: 44px;
    padding: 8px;
}

body.in-apppresser-ratings .feedback-option {
    padding: 16px 20px;
    font-size: 16px;
    min-height: 54px;
}

body.in-apppresser-ratings .directory-feedback-submit button {
    padding: 16px 30px;
    font-size: 16px;
    width: 100%;
    min-height: 54px;
}

/* iframe context fixes */
body.in-apppresser .directory-rating-widget,
body.in-apppresser .directory-feedback-widget {
    max-width: 100vw;
    overflow-x: hidden;
}

/* ============================================
   BEAVER BUILDER INTEGRATION
   ============================================ */

.fl-module .directory-rating-widget,
.fl-module .directory-feedback-widget {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

.fl-module .directory-star-rating {
    justify-content: center;
}

.fl-module .directory-feedback-options {
    justify-content: center;
}

/* Widget context */
.widget .directory-rating-widget,
.widget .directory-feedback-widget {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    margin: 10px 0;
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .directory-rating-widget,
    .directory-feedback-widget {
        background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
        border-color: #444;
    }
    
    .directory-rating-title,
    .directory-feedback-title {
        color: #fff;
    }
    
    .directory-rating-number {
        color: #fff;
    }
    
    .directory-rating-count {
        color: #aaa;
    }
    
    .feedback-option {
        background: #333;
        border-color: #555;
        color: #fff;
    }
    
    .feedback-option:hover {
        background: #3a3a3a;
    }
    
    .feedback-option .vote-count {
        background: rgba(255, 255, 255, 0.15);
        color: #ccc;
    }
    
    .feedback-item {
        background: #2a2a2a;
    }
    
    .feedback-item .label {
        color: #fff;
    }
    
    .feedback-item .bar {
        background: #444;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .directory-rating-widget,
    .directory-feedback-widget {
        break-inside: avoid;
        background: #fff !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
    
    .directory-star-rating .star {
        cursor: default;
    }
    
    .feedback-option {
        cursor: default;
        border: 1px solid #ccc;
    }
    
    .directory-feedback-submit {
        display: none;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.directory-star-rating:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 4px;
    border-radius: 4px;
}

.directory-star-rating .star:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.feedback-option:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.directory-feedback-submit button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Screen reader text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
