/**
 * Campaign Comments CSS
 *
 * Styles for the campaign comments system
 *
 * @package RaiseFi_Core
 * @since 3.0.0
 */

/* Comments Section Container */
.raisefi-comments-section {
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

/* Comments Header */
.raisefi-comments-header {
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 10px;
}

.raisefi-comments-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.raisefi-comments-description {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
}

/* Comment Form */
.raisefi-comment-form-container {
    margin-bottom: 10px;
}

.raisefi-comment-form {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.raisefi-comment-author {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.raisefi-comment-author img {
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid #e9ecef;
}

.raisefi-comment-author-info strong {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
}

/* Comment Form - Badge positioning for author info */
.raisefi-comment-author-info .raisefi-platform-admin-badge,
.raisefi-comment-author-info .raisefi-creator-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0;
    margin-top: 4px;
}

.raisefi-creator-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

/* Platform Admin Badge - Distinguished from Creator badge */
.raisefi-platform-admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a2e;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    box-shadow: 0 2px 4px rgba(255, 165, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.raisefi-platform-admin-badge::before {
    content: '🛡️';
    font-size: 10px;
}

/* Platform Admin Comment Styling - Subtle left border highlight */
.raisefi-comment.raisefi-platform-admin-comment {
    border-left: 3px solid #FFD700;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.05) 0%, transparent 20%);
}

.raisefi-comment.raisefi-platform-admin-comment .raisefi-comment-header img {
    border: 2px solid #FFD700;
}

.raisefi-comment-input-container {
    position: relative;
}

#raisefi-comment-content {
    width: 100%;
    min-height: 80px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
    background: white;
}

#raisefi-comment-content:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.raisefi-comment-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

/* Buttons */
.raisefi-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* Compact button style - 15% smaller */
.raisefi-btn-compact,
.raisefi-comment-actions .raisefi-btn-compact,
.raisefi-comment-form .raisefi-btn-compact {
    padding: 8.5px 17px !important;
    font-size: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    min-height: 34px !important;
    height: auto !important;
}

.raisefi-btn-compact svg {
    flex-shrink: 0;
    width: 14px !important;
    height: 14px !important;
}

.raisefi-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.raisefi-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.raisefi-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.raisefi-btn-secondary {
    background: #6c757d;
    color: white;
}

.raisefi-btn-secondary:hover {
    background: #5a6268;
}

/* Login Prompt */
.raisefi-login-prompt {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 30px;
}

.raisefi-login-prompt p {
    margin: 0;
    font-size: 16px;
    color: #6c757d;
}

.raisefi-login-prompt a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.raisefi-login-prompt a:hover {
    text-decoration: underline;
}

/* Comments Container */
.raisefi-comments-container {
    position: relative;
}

.raisefi-comments-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-style: italic;
}

.raisefi-no-comments {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.raisefi-no-comments p {
    margin: 0;
    font-size: 16px;
}

/* Comments List */
.raisefi-comments-list {
    margin-top: 20px;
}

/* Individual Comment */
.raisefi-comment {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 16px;
    transition: box-shadow 0.3s ease;
}

.raisefi-comment:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.raisefi-comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

/* Wrapper for avatar and meta info */
.raisefi-comment-author-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0; /* Prevent overflow */
}

.raisefi-comment-header > div:first-child {
    display: flex;
    align-items: center;
}

.raisefi-comment-header img {
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid #e9ecef;
}

.raisefi-comment-meta {
    display: flex;
    flex-direction: column;
}

.raisefi-comment-author {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.raisefi-comment-date {
    font-size: 12px;
    color: #6c757d;
}

.raisefi-comment-actions {
    display: flex;
    gap: 10px;
}

.raisefi-delete-comment {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.raisefi-delete-comment:hover {
    background: #f8d7da;
}

/* Comment Content */
.raisefi-comment-content {
    margin-bottom: 15px;
}

.raisefi-comment-content p {
    margin: 0;
    line-height: 1.6;
    color: #495057;
}

/* Comment Footer */
.raisefi-comment-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.raisefi-reply-button {
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.raisefi-reply-button:hover {
    background: #f8f9fa;
    color: #5a67d8;
}

/* Comment Replies */
.raisefi-comment-replies {
    margin-top: 20px;
    margin-left: 40px;
    border-left: 3px solid #e9ecef;
    padding-left: 20px;
}

.raisefi-comment-replies .raisefi-comment {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* Error Messages */
.raisefi-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .raisefi-comments-section {
        margin: 20px 0;
        padding: 20px;
        border-radius: 8px;
    }

    .raisefi-comments-header h3 {
        font-size: 20px;
    }

    .raisefi-comment-form {
        padding: 15px;
    }

    .raisefi-comment {
        padding: 15px;
    }

    .raisefi-comment-replies {
        margin-left: 20px;
        padding-left: 15px;
    }

    .raisefi-comment-actions {
        flex-direction: column;
        gap: 10px;
    }

    .raisefi-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .raisefi-comments-section {
        padding: 15px;
    }

    .raisefi-comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .raisefi-comment-replies {
        margin-left: 10px;
        padding-left: 10px;
    }
}

/* Animation for new comments */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.raisefi-comment {
    animation: slideInUp 0.3s ease-out;
}

/* Focus states for accessibility */
.raisefi-reply-button:focus,
.raisefi-delete-comment:focus,
.raisefi-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading state */
.raisefi-btn:disabled {
    position: relative;
}

.raisefi-btn:disabled::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* =====================================================
   Image Upload Section Styles
   ===================================================== */

/* Image Upload Section */
.raisefi-image-upload-section {
    margin-top: 15px;
}

.raisefi-btn-outline {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
}

.raisefi-btn-outline:hover {
    background: #667eea;
    color: white;
}

.raisefi-btn-outline svg {
    width: 14px;
    height: 14px;
}

/* Image Preview */
.raisefi-image-preview-container {
    margin-top: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
}

.raisefi-image-preview-wrapper {
    position: relative;
    display: inline-block;
}

#raisefi-image-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.raisefi-remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s;
}

.raisefi-remove-image-btn:hover {
    background: #c82333;
}

.raisefi-remove-image-btn svg {
    width: 14px;
    height: 14px;
}

.raisefi-image-caption-input {
    margin-top: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.raisefi-image-caption-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.raisefi-progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.raisefi-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.raisefi-progress-text {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

/* =====================================================
   Comment Image Display Styles
   ===================================================== */

.raisefi-comment-image-container {
    margin-top: 12px;
}

.raisefi-lightbox-trigger {
    display: inline-block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.raisefi-lightbox-trigger:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.raisefi-comment-thumbnail {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    display: block;
}

.raisefi-image-zoom-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
}

.raisefi-lightbox-trigger:hover .raisefi-image-zoom-icon {
    opacity: 1;
}

.raisefi-image-zoom-icon svg {
    width: 14px;
    height: 14px;
}

.raisefi-comment-image-caption {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    max-width: 300px;
}

/* =====================================================
   Lightbox Styles
   ===================================================== */

.raisefi-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.raisefi-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.raisefi-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

#raisefi-lightbox-image {
    max-width: 600px;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.raisefi-lightbox-caption {
    margin-top: 16px;
    color: white;
    font-size: 14px;
    text-align: center;
    max-width: 600px;
}

.raisefi-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background-color 0.2s;
}

.raisefi-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.raisefi-lightbox-close svg {
    width: 20px;
    height: 20px;
}

/* Lightbox Navigation Buttons */
.raisefi-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
    z-index: 10;
}

.raisefi-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.raisefi-lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.raisefi-lightbox-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.raisefi-lightbox-prev {
    left: -70px;
}

.raisefi-lightbox-next {
    right: -70px;
}

.raisefi-lightbox-nav svg {
    width: 28px;
    height: 28px;
}

/* Lightbox Footer with Caption and Counter */
.raisefi-lightbox-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 16px;
    gap: 8px;
}

.raisefi-lightbox-caption {
    margin: 0;
    color: white;
    font-size: 14px;
    text-align: center;
    max-width: 600px;
}

.raisefi-lightbox-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 16px;
}

/* Lightbox Image Loading State */
#raisefi-lightbox-image {
    max-width: 600px;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: opacity 0.2s ease;
}

/* Prevent body scroll when lightbox is open */
body.raisefi-lightbox-open {
    overflow: hidden;
}

/* =====================================================
   Lightbox Responsive Styles
   ===================================================== */

@media (max-width: 768px) {
    .raisefi-lightbox-content {
        max-width: 100vw;
        padding: 0 60px;
    }

    #raisefi-lightbox-image {
        max-width: 95vw;
        max-height: 70vh;
    }

    .raisefi-lightbox-close {
        top: 10px;
        right: 10px;
        position: fixed;
    }

    .raisefi-lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .raisefi-lightbox-prev {
        left: 10px;
        position: fixed;
    }

    .raisefi-lightbox-next {
        right: 10px;
        position: fixed;
    }

    .raisefi-lightbox-nav svg {
        width: 22px;
        height: 22px;
    }

    .raisefi-lightbox-footer {
        position: fixed;
        bottom: 20px;
        left: 0;
        right: 0;
        padding: 0 20px;
    }
}

@media (max-width: 480px) {
    .raisefi-comment-thumbnail {
        width: 100px;
        height: 100px;
    }

    #raisefi-image-preview {
        max-width: 120px;
        max-height: 120px;
    }

    .raisefi-lightbox-nav {
        width: 36px;
        height: 36px;
    }

    .raisefi-lightbox-nav svg {
        width: 18px;
        height: 18px;
    }
}

/* =====================================================
   Multiple Image Upload Styles
   ===================================================== */

/* Image counter badge */
.raisefi-image-counter {
    display: inline-block;
    background: #667eea;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

.raisefi-image-counter:empty {
    display: none;
}

/* Multiple image previews container */
.raisefi-image-previews-container {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.raisefi-previews-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.raisefi-preview-item {
    position: relative;
    width: 120px;
    border-radius: 8px;
    overflow: visible;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s;
    padding: 4px;
    background: #fff;
}

.raisefi-preview-item:hover {
    border-color: #667eea;
}

.raisefi-preview-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

/* Per-image caption input */
.raisefi-per-image-caption {
    width: 100% !important;
    margin-top: 4px !important;
    padding: 4px 6px !important;
    font-size: 11px !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    box-sizing: border-box !important;
}

.raisefi-remove-preview-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(220, 53, 69, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 0;
    transition: background 0.2s;
}

.raisefi-remove-preview-btn:hover {
    background: #dc3545;
}

.raisefi-remove-preview-btn svg {
    width: 12px;
    height: 12px;
}

/* Images grid in comments (for multiple images) */
.raisefi-comment-images-container {
    margin-top: 10px;
    display: block;
}

.raisefi-comment-images-container.raisefi-images-grid {
    display: -webkit-box;      /* Old Safari/Chrome */
    display: -ms-flexbox;      /* IE 10 */
    display: -webkit-flex;     /* Safari 6.1+ */
    display: flex;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 8px;
}

/* Fallback for browsers without gap support */
@supports not (gap: 8px) {
    .raisefi-comment-images-container.raisefi-images-grid {
        margin: -4px;
    }
    .raisefi-comment-images-container.raisefi-images-grid > * {
        margin: 4px;
    }
}

.raisefi-comment-image-item {
    position: relative;
    display: inline-block;
    vertical-align: top;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.raisefi-images-grid .raisefi-comment-image-item {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    display: inline-block;
}

.raisefi-images-grid .raisefi-comment-thumbnail {
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
}

/* Disabled button state */
.raisefi-upload-image-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments for multiple images */
@media (max-width: 768px) {
    .raisefi-preview-item {
        width: 100px;
    }
    
    .raisefi-preview-item img {
        height: 70px;
    }

    .raisefi-images-grid .raisefi-comment-thumbnail {
        width: 100px;
        height: 100px;
    }

    .raisefi-comment-images-container.raisefi-images-grid {
        -webkit-flex-direction: row;
        -ms-flex-direction: row;
        flex-direction: row;
    }
}

@media (max-width: 480px) {
    .raisefi-preview-item {
        width: 90px;
    }
    
    .raisefi-preview-item img {
        height: 60px;
    }

    .raisefi-images-grid .raisefi-comment-thumbnail {
        width: 80px;
        height: 80px;
    }

    .raisefi-previews-grid {
        gap: 6px;
    }

    .raisefi-images-grid {
        gap: 6px;
    }

    .raisefi-comment-images-container.raisefi-images-grid {
        -webkit-flex-direction: row;
        -ms-flex-direction: row;
        flex-direction: row;
    }
}
