/**
 * Secção de Feedback reutilizável
 * Usado em Comunidade, Xperiences e outras páginas.
 * Opções: data-show-faq="true|false", data-experience-id="id" (opcional)
 */

/* Secção Unificada Feedbacks (e opcionalmente FAQs) */
.feedback-section-wrapper {
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
}

.feedback-section-wrapper .feedbacks-faq-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

.feedback-section-wrapper .feedbacks-faq-container .carousel-header {
    margin-bottom: 2rem;
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
}

.feedback-section-wrapper .carousel-header {
    padding-top: 0;
    margin-top: 0;
}

.feedback-section-wrapper .feedbacks-faq-layout {
    position: relative;
    width: 100%;
    min-height: 500px;
}

.feedback-section-wrapper .feedbacks-header-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

/* Esconder botão FAQ quando a secção não mostra FAQs */
.feedback-section-wrapper:not([data-show-faq="true"]) .feedbacks-header-with-button .btn-primary#faqToggleBtn,
.feedback-section-wrapper:not([data-show-faq="true"]) .faq-toggle-btn {
    display: none !important;
}

#faqToggleBtn.btn-primary {
    background: rgba(20, 20, 20, 0.9) !important;
    color: var(--primary-neon) !important;
    border: 2px solid var(--primary-neon) !important;
    border-radius: 50px !important;
    padding: 1rem 2rem !important;
    font-size: var(--text-base) !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    text-decoration: none !important;
    position: relative !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}

#faqToggleBtn.btn-primary:hover {
    background: rgba(30, 30, 30, 0.95) !important;
    color: var(--primary-neon) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 0 10px var(--primary-neon), 0 0 20px var(--primary-neon), 0 0 30px var(--primary-neon) !important;
}

.feedback-section-wrapper .feedbacks-side {
    width: 100%;
    overflow: hidden;
    padding: 0;
    background: transparent !important;
}

.feedback-section-wrapper .feedbacks-side .feedbacks-carousel {
    width: 100%;
    max-width: 100%;
    position: relative;
    background: transparent !important;
}

.feedback-section-wrapper .feedbacks-side .carousel-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    background: transparent !important;
}

.feedback-section-wrapper .feedbacks-side .feedbacks-grid {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.feedback-section-wrapper .feedbacks-subtitle h3,
.feedback-section-wrapper .faqs-subtitle h3 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.feedback-section-wrapper .feedbacks-subtitle h3 i {
    color: var(--success-neon);
}

/* FAQ Sidebar - escondida quando data-show-faq não é true */
.feedback-section-wrapper:not([data-show-faq="true"]) .faqs-sidebar {
    display: none !important;
}

.faqs-sidebar {
    position: absolute;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100%;
    background: linear-gradient(135deg, rgba(10, 10, 20, 0.98), rgba(20, 20, 40, 0.98));
    backdrop-filter: blur(20px);
    border-left: 2px solid rgba(0, 229, 255, 0.2);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    overflow-x: hidden;
    visibility: hidden;
    opacity: 0;
}

.faqs-sidebar.active {
    right: 0;
    visibility: visible;
    opacity: 1;
    display: block;
}

.faqs-sidebar:not(.active) {
    display: none !important;
}

.feedback-section-wrapper .feedbacks-faq-layout.has-sidebar .feedbacks-side {
    width: calc(100% - 450px);
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.faqs-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid rgba(0, 229, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 10;
}

.faqs-sidebar-header h3 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.faqs-sidebar-header h3 i {
    color: var(--primary-neon);
}

.faqs-sidebar-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 229, 255, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.faqs-sidebar-close:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.5);
    transform: rotate(90deg);
}

.faqs-sidebar .faq-list {
    padding: 1.5rem;
}

.faqs-sidebar::-webkit-scrollbar {
    width: 6px;
}

.faqs-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.faqs-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3);
    border-radius: 10px;
}

.faqs-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.5);
}

.faqs-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, 0.3) rgba(255, 255, 255, 0.05);
}

.faqs-sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.faqs-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.feedback-section-wrapper .feedbacks-carousel {
    position: relative;
    width: 100%;
    background: transparent !important;
}

.feedback-section-wrapper .feedbacks-carousel .carousel-wrapper {
    overflow: hidden;
    padding: 0.5rem 0;
    height: auto;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: transparent !important;
}

.feedback-section-wrapper .feedbacks-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.feedback-section-wrapper .feedbacks-grid.infinite-initialized {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
}

.feedback-section-wrapper .feedbacks-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 1rem;
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.5rem 0;
    max-width: 100%;
}

.feedback-section-wrapper .feedbacks-row::-webkit-scrollbar {
    display: none;
}

.feedback-section-wrapper .feedbacks-row .feedback-card {
    flex-shrink: 0 !important;
    margin: 0 !important;
    display: block !important;
    float: none !important;
}

.feedback-section-wrapper .feedbacks-row-1,
.feedback-section-wrapper .feedbacks-row-2 {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Cards de feedback */
.feedback-section-wrapper .feedback-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-width: 280px !important;
    max-width: 280px !important;
    width: 280px !important;
    flex-shrink: 0 !important;
    cursor: pointer;
    height: fit-content;
}

.feedback-section-wrapper .feedback-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--success-neon), var(--primary-neon));
    opacity: 0;
    transition: var(--transition);
}

.feedback-section-wrapper .feedback-card:hover {
    border-color: var(--success-neon);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
    transform: translateY(-4px);
}

.feedback-section-wrapper .feedback-card:hover::before {
    opacity: 1;
}

.feedback-section-wrapper .feedback-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.feedback-section-wrapper .feedback-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success-neon), var(--primary-neon));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bg-primary);
    border: 2px solid var(--success-neon);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.feedback-section-wrapper .feedback-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.feedback-section-wrapper .feedback-avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-section-wrapper .feedback-user {
    flex: 1;
}

.feedback-section-wrapper .feedback-username {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.feedback-section-wrapper .feedback-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.feedback-section-wrapper .feedback-rating {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.feedback-section-wrapper .feedback-stars {
    display: flex;
    gap: 0.25rem;
}

.feedback-section-wrapper .feedback-star {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.feedback-section-wrapper .feedback-star.active {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.feedback-section-wrapper .feedback-content {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-top: 1rem;
    max-height: 4.8em;
    overflow: hidden;
    position: relative;
}

.feedback-section-wrapper .feedback-content::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 0;
    background: linear-gradient(to right, transparent, var(--bg-glass));
    padding-left: 1rem;
}

.feedback-section-wrapper .feedback-read-more {
    margin-top: 0.5rem;
    font-size: var(--text-xs);
    color: var(--primary-neon);
    font-weight: 600;
    display: inline-block;
}

.feedback-section-wrapper .feedback-context {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-style: italic;
}

/* Modal de feedback (global - uma por página) */
.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.feedback-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.feedback-modal-content {
    position: relative;
    background: var(--bg-glass);
    backdrop-filter: blur(30px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10001;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.feedback-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    z-index: 10002;
}

.feedback-modal-close:hover {
    background: var(--primary-neon);
    border-color: var(--primary-neon);
    color: var(--bg-primary);
    transform: rotate(90deg);
}

/* FAQ items dentro da sidebar */
.faq-item {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary-neon);
}

.faq-item.active {
    border-color: var(--primary-neon);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
}

.faq-question {
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.faq-question:hover {
    background: rgba(0, 229, 255, 0.05);
}

.faq-question-text {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.4;
}

.faq-question-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.1);
    border: 2px solid var(--primary-neon);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-neon);
    transition: var(--transition);
    flex-shrink: 0;
}

.faq-item.active .faq-question-icon {
    transform: rotate(180deg);
    background: rgba(0, 229, 255, 0.2);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 1rem;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding: 0.75rem 1rem 1rem 1rem;
}

.faq-answer-content {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .feedback-section-wrapper .feedbacks-header-with-button {
        flex-direction: column;
        align-items: flex-start;
    }

    .feedback-section-wrapper #faqToggleBtn.btn-primary {
        width: 100%;
        justify-content: center;
    }

    .faqs-sidebar {
        width: 100%;
        right: -100%;
    }

    .faqs-sidebar.active {
        right: 0;
    }

    .feedback-section-wrapper .feedback-card {
        padding: 1.5rem;
    }
}
