/**
 * Main Q&A Plugin Styles
 * v1.3 - Added star rating system styles
 */

/* ===============================================
   STAR RATING SYSTEM STYLES
   =============================================== */

/* Star Rating Container */
.qa-star-rating {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    font-size: 14px;
}

/* Star Display Container */
.qa-star-display {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Individual Star Styles */
.qa-star {
    font-size: 18px;
    color: #ccc;
    transition: color 0.2s ease, background-color 0.2s ease;
    user-select: none;
    line-height: 1;
    width: 20px;
    text-align: center;
    display: inline-block;
}

/* Filled Stars (Average Rating) - More vibrant gold */
.qa-star.filled {
    color: #ff9500;
    font-weight: 600;
}

/* Interactive Stars */
.qa-star.interactive {
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
}

/* Remove hover color change as requested */
.qa-star.interactive:hover {
    background-color: rgba(255, 149, 0, 0.1);
    /* No color change on hover */
}

/* User's Rating Highlight - Use same vibrant color */
.qa-star.user-filled {
    color: #ff9500;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(255, 149, 0, 0.5);
}

/* Hover State - Use same vibrant color */
.qa-star.hover-filled {
    color: #ff9500;
}

/* Rating Statistics */
.qa-rating-stats {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: #666;
}

.qa-avg-rating {
    font-weight: 600;
    color: #333;
}

.qa-rating-count {
    font-size: 12px;
    color: #999;
}

/* User Rating Display */
.qa-user-rating {
    font-size: 12px;
    color: #007cba;
    font-style: italic;
}

/* Loading State */
.qa-rating-loading {
    opacity: 0.6;
    pointer-events: none;
}

.qa-rating-loading .qa-star.interactive {
    cursor: not-allowed;
}

/* Rating Messages */
.qa-rating-message {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 5px;
    flex-basis: 100%;
    text-align: center;
}

.qa-rating-message.qa-message-success {
    background-color: #d1f2eb;
    color: #0c5b47;
    border: 1px solid #7dd3c0;
}

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

.qa-rating-message.qa-message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Rating in Question Lists */
.qa-question-item .qa-star-rating {
    margin-top: 5px;
    font-size: 13px;
}

.qa-question-item .qa-star {
    font-size: 16px;
}

/* Rating in Single Question/Answer View */
.qa-single-question-view .qa-star-rating,
.qa-answer-item .qa-star-rating {
    margin: 15px 0;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
}

/* Integration with Voting Buttons */
.qa-voting-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    padding: 10px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.qa-vote-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qa-star-rating-section {
    flex: 1;
    min-width: 200px;
}

/* Responsive Design for Star Ratings */
@media (max-width: 767px) {
    .qa-star-rating {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .qa-star-display {
        gap: 3px;
    }
    
    .qa-star {
        font-size: 20px;
        padding: 4px;
    }
    
    .qa-voting-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .qa-star-rating-section {
        min-width: auto;
    }
}

/* ===============================================
   VISIBILITY INDICATOR STYLES
   =============================================== */

/* Visibility Icons */
.qa-visibility-icon {
    display: inline-block;
    margin-right: 6px;
    font-size: 14px;
    vertical-align: middle;
}

.qa-visibility-icon.qa-visibility-public {
    color: #28a745;
}

.qa-visibility-icon.qa-visibility-private {
    color: #dc3545;
}

/* Visibility Notices */
.qa-visibility-notice {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.qa-visibility-notice p {
    margin-bottom: 15px;
    color: #6c757d;
}

.qa-login-link {
    display: inline-block;
    background-color: #0073aa;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.qa-login-link:hover {
    background-color: #005a87;
    color: white;
}

/* Admin Category Visibility Indicators */
.qa-visibility-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.qa-visibility-description {
    font-size: 11px;
    color: #666;
    margin-top: 3px;
    font-style: italic;
}

/* Question List Visibility Styling */
.qa-question-title .qa-visibility-icon {
    position: relative;
    top: -1px;
}

/* ===============================================
   CATEGORY LISTING STYLES
   =============================================== */

/* Category Listing Container */
.qa-categories-listing {
    margin: 20px 0;
}

/* Grid Layout (Default) */
.qa-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* List Layout */
.qa-categories-list .qa-category-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.qa-categories-list .qa-category-item:last-child {
    border-bottom: none;
}

/* Cards Layout */
.qa-categories-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.qa-categories-cards .qa-category-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.qa-categories-cards .qa-category-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Category Item */
.qa-category-item {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid transparent;
}

.qa-category-item.qa-category-public {
    border-left-color: #28a745;
}

.qa-category-item.qa-category-private {
    border-left-color: #dc3545;
}

/* Category Header */
.qa-category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.qa-category-name {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
}

.qa-category-name a {
    text-decoration: none;
    color: #333;
    transition: color 0.2s ease;
}

.qa-category-name a:hover {
    color: #0073aa;
}

.qa-category-count {
    font-size: 0.9em;
    color: #666;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

/* Category Description */
.qa-category-description {
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* Visibility Note */
.qa-category-visibility-note {
    color: #888;
    font-size: 0.85em;
    margin-top: 8px;
    padding: 8px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
}

/* No Categories Message */
.qa-no-categories {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .qa-categories-grid,
    .qa-categories-cards {
        grid-template-columns: 1fr;
    }
    
    .qa-category-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .qa-category-count {
        align-self: flex-start;
    }
}

/* Dark Mode Support - Only for Q&A elements */
@media (prefers-color-scheme: dark) {
    .photoresk-qa-container .qa-star,
    .qa-question-page .qa-star,
    .qa-star-rating .qa-star {
        color: #666;
    }
    
    .photoresk-qa-container .qa-star.filled,
    .qa-question-page .qa-star.filled,
    .qa-star-rating .qa-star.filled {
        color: #ff9500;
    }
    
    .photoresk-qa-container .qa-star.user-filled,
    .qa-question-page .qa-star.user-filled,
    .qa-star-rating .qa-star.user-filled {
        color: #ff9500;
        text-shadow: 0 0 2px rgba(255, 149, 0, 0.7);
    }
    
    .photoresk-qa-container .qa-star.interactive:hover,
    .qa-question-page .qa-star.interactive:hover,
    .qa-star-rating .qa-star.interactive:hover {
        background-color: rgba(255, 149, 0, 0.15);
    }
    
    .qa-rating-stats {
        color: #ccc;
    }
    
    .qa-avg-rating {
        color: #fff;
    }
    
    .qa-rating-count {
        color: #999;
    }
    
    .qa-user-rating {
        color: #ffd700;
    }
    
    /* Dark mode visibility styling */
    .qa-visibility-notice {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .qa-visibility-notice p {
        color: #cbd5e0;
    }
    
    .qa-visibility-description {
        color: #a0aec0;
    }
    
    /* Dark mode category listing */
    .qa-category-item {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .qa-categories-cards .qa-category-item {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .qa-category-name a {
        color: #e2e8f0;
    }
    
    .qa-category-name a:hover {
        color: #90cdf4;
    }
    
    .qa-category-description {
        color: #cbd5e0;
    }
    
    .qa-category-count {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .qa-category-visibility-note {
        background: rgba(220, 53, 69, 0.2);
        color: #fbb6ce;
    }
    
    .qa-no-categories {
        background: #2d3748;
        color: #cbd5e0;
    }
}

/* Question List Styles */
.photoresk-qa-questions-list .qa-question-item {
    padding: 20px;
    border-bottom: 1px solid #eee;
    background-color: #fff;
    margin-bottom: 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.qa-question-content-wrap {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
}
.qa-question-text-content {
    flex: 1;
    min-width: 0;
}
.qa-question-thumbnail-right {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    order: 2;
}
.qa-question-thumbnail-right img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}
.qa-question-title {
    margin: 0 0 8px 0;
    font-size: 1.3em;
}
.qa-question-title a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
}
.qa-question-title a:hover {
    color: #0073aa;
}
.qa-question-meta {
    font-size: 0.9em;
    color: #777;
}
.qa-question-meta span {
    margin-right: 15px;
}

/* Single Question & Answer View */
.qa-single-question-view {
    padding: 10px;
}
.qa-breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9em;
}
.qa-question-body, .qa-answer-body {
    margin-bottom: 20px;
    line-height: 1.7;
    font-size: 1.1em;
}
.qa-answers-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.qa-answer-item {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}
.qa-answer-meta {
    margin-top: 15px;
    font-size: 0.9em;
    color: #777;
}

/* Single Question Content Layout */
.qa-question-content-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 20px;
}
.qa-question-text {
    flex: 1;
    min-width: 0;
}
.qa-question-images-right {
    flex-shrink: 0;
    width: 250px;
    max-width: 35%;
}
.qa-question-images-right .qa-gallery-grid {
    display: grid;
    gap: 10px;
}
.qa-question-images-right .qa-gallery-grid .qa-gallery-image-item {
    margin-bottom: 0;
}
.qa-question-images-right .qa-gallery-grid img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Sizing Fix: Style the standard textarea in the answer form */
.qa-answer-form-section {
    margin-top: 40px;
}
#qa-answer-form textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    margin-bottom: 10px;
    box-sizing: border-box; /* Important for layout */
}

/* Image Gallery Styles */
.qa-images-gallery {
    margin-top: 20px;
}
.qa-images-gallery h4 {
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
}
.qa-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}
.qa-gallery-image-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    border: 1px solid #eee;
    transition: opacity 0.2s;
}
.qa-gallery-image-item a:hover img {
    opacity: 0.8;
}


/* Generic Form & Button Styles */
.qa-form {
    margin-top: 20px;
}
.qa-form-field {
    margin-bottom: 20px;
}
.qa-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}
.qa-btn:hover {
    background-color: #005a87;
}
.qa-messages {
    margin-top: 15px;
    padding: 15px;
    border-radius: 4px;
}
.qa-messages.success { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.qa-messages.error { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }

/* Image Upload Drop Zone Styles */
.qa-image-upload-section {
    margin-bottom: 25px;
}

.qa-image-upload-container {
    margin-top: 10px;
}

.qa-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    font-size: 1.1em;
}

.qa-drop-zone:hover {
    border-color: #0073aa;
    background-color: #f0f6ff;
    color: #0073aa;
}

.qa-drop-zone.drag-over {
    border-color: #0073aa;
    background-color: #e6f3ff;
    color: #0073aa;
}

.qa-drop-zone p {
    margin: 0;
    font-weight: 500;
}

/* Image Upload Preview Styles */
.qa-image-upload-container .qa-image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}
.qa-image-upload-container .qa-gallery-image {
    position: relative;
    width: 100%;
    height: 100px; /* Fixed height instead of padding trick */
    overflow: hidden;
    border-radius: 4px;
}
.qa-image-upload-container .qa-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qa-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background-color: #f0f0f0;
    color: #999;
    font-size: 12px;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

/* Image Gallery Grid */
.qa-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.qa-gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    border: 1px solid #e9ecef;
}

.qa-gallery-image {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.qa-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qa-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qa-gallery-item:hover .qa-image-overlay {
    opacity: 1;
}

.qa-image-action {
    background: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    margin: 0 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.qa-image-action:hover {
    transform: scale(1.1);
}

.qa-gallery-caption {
    padding: 8px;
    font-size: 0.85em;
    color: #6c757d;
    text-align: center;
}

/* Upload Progress Styles */
.qa-upload-progress {
    margin-top: 15px;
}

.qa-upload-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 10px;
}

.qa-upload-item.upload-success {
    border-color: #28a745;
    background: #f8fff9;
}

.qa-upload-item.upload-error {
    border-color: #dc3545;
    background: #fff8f8;
}

.qa-upload-progress-bar {
    background: #e9ecef;
    border-radius: 3px;
    height: 6px;
    margin: 10px 0;
    overflow: hidden;
}

.qa-upload-progress-fill {
    background: #0073aa;
    height: 100%;
    transition: width 0.3s ease;
    width: 0%;
}

/* Lightbox Styles */
.qa-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.qa-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}

.qa-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-lightbox-close,
.qa-lightbox-prev,
.qa-lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    z-index: 10001;
}

.qa-lightbox-close {
    top: 20px;
    right: 20px;
}

.qa-lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.qa-lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.qa-lightbox-image-container {
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.qa-lightbox-image {
    max-width: 100%;
    max-height: 100%;
}

.qa-lightbox-caption {
    color: white;
    margin-top: 10px;
}

.qa-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 4px;
}

/* ===============================================
   PHOTOGRAPHER PROFILE LINKS
   =============================================== */

/* Photographer profile links in Q&A displays */
.qa-photographer-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.qa-photographer-link:hover {
    color: #005a87;
    text-decoration: underline;
}

.qa-photographer-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}