/* --- public/css/reviews.css --- */

/* =========================================
   1. HERO & PAGE LAYOUT (Inherits from home.css)
   ========================================= */
.community-page {
    padding-bottom: 80px;
    background-color: #F8FAFC; 
    min-height: 100vh;
}

/* Overriding specific hero styles to give the community page its own flavor */
.community-hero-banner {
    background: linear-gradient(135deg, var(--brand-primary, #0A2540) 0%, var(--brand-accent, #1B9A93) 100%) !important;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
}

.community-hero-banner::before,
.community-hero-banner .hero-overlay {
    display: none !important;
}

.community-hero-banner .hero-content h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 12px;
    letter-spacing: 1px;
    color: #FFFFFF;
    text-shadow: none; 
}

.community-hero-banner .hero-content p {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
    color: #FFFFFF;
    max-width: 600px;
}

/* =========================================
   2. STICKY SEGMENTED CONTROL (Tabs)
   ========================================= */
.tab-navigation-wrapper {
    position: sticky;
    top: 70px; /* Desktop Header Height */
    z-index: 100;
    padding: 10px 0 20px 0;
    margin-top: -35px; /* Overlap the hero banner */
    display: flex;
    justify-content: center;
    pointer-events: none; 
}

.segmented-control {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(225, 232, 237, 0.8);
    border-radius: 50px;
    display: inline-flex;
    padding: 6px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    pointer-events: auto; 
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted, #6B7280);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--brand-primary, #0A2540);
}

.tab-btn.active {
    background: var(--brand-primary, #0A2540);
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(10, 37, 64, 0.2);
}


/* =========================================
   3. TAB PANES & ANIMATIONS
   ========================================= */
.community-content {
    margin-top: 20px;
}

.tab-pane {
    display: none;
    opacity: 0;
    transform: translateY(10px);
}

.tab-pane.active {
    display: block;
    animation: fadeUpIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUpIn {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: #FFFFFF;
    border-radius: 24px;
    border: 1px dashed var(--border-light, #E1E8ED);
    color: var(--text-muted, #6B7280);
}

.empty-state i {
    font-size: 3rem;
    color: #CBD5E1;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-main, #1F2937);
    margin-bottom: 8px;
}


/* =========================================
   4. MAGAZINE GRID (True Masonry Layout)
   ========================================= */
.magazine-grid {
    column-count: 3;
    column-gap: 32px;
    width: 100%;
}

.magazine-card {
    background: #FFFFFF;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(225, 232, 237, 0.8);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 32px; 
}

.magazine-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.card-cover {
    width: 100%;
    aspect-ratio: 3 / 4; 
    background-size: cover;
    background-position: center top; 
    position: relative;
    border-bottom: 1px solid rgba(225, 232, 237, 0.5); 
}

.fallback-cover {
    background: linear-gradient(135deg, #F1F5F9 0%, #E2E8F0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4; 
}

.fallback-cover i {
    font-size: 3rem;
    color: #CBD5E1;
}

.store-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(10, 37, 64, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #FFFFFF;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 50px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.card-body {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.masseur-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-main, #1F2937);
    margin-bottom: 8px;
}

.role-tag {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand-accent, #1B9A93);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.radar-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.score-pill {
    background: #F1F5F9;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.score-pill strong {
    color: var(--text-main, #1F2937);
    margin-left: 2px;
}

.score-pill.highlight {
    background: rgba(255, 215, 0, 0.15); 
    color: #B45309; 
}

.review-snippet.full-text {
    margin-bottom: 10px;
}

.review-snippet.full-text p {
    font-size: 0.95rem;
    line-height: 1.8; 
    color: #4B5563; 
    margin: 0;
    white-space: pre-wrap; 
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px dashed var(--border-light, #E1E8ED);
    display: flex;
    justify-content: center; 
    align-items: center;
    background: #FAFAFA;
}

.date-info {
    font-size: 0.85rem;
    color: #9CA3AF;
    font-weight: 500;
    letter-spacing: 1px; 
}


/* =========================================
   5. TIMELINE FEED (Live Discussions)
   ========================================= */
.timeline-feed {
    max-width: 760px; /* Tighter for optimal reading length */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-bubble-wrapper {
    display: flex;
    gap: 16px;
    position: relative;
    transition: transform 0.2s ease; 
}

/* --- THE NEW REPLY THREADING UI --- */
.chat-bubble-wrapper.is-reply {
    margin-top: -8px; 
    margin-left: 48px; /* Indents the entire reply block */
}

/* The Routing Branch */
.chat-bubble-wrapper.is-reply::before {
    content: '';
    position: absolute;
    top: -28px;
    left: -32px; /* Reaches out to the left of the indented bubble */
    width: 28px;
    height: 48px;
    border-left: 3px solid #94A3B8; /* Stronger slate grey */
    border-bottom: 3px solid #94A3B8;
    border-bottom-left-radius: 16px; 
    z-index: 0;
}

.chat-avatar {
    flex-shrink: 0;
    z-index: 1;
}

.chat-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); 
    border: 2px solid #FFFFFF; 
}

/* Visually shrink the avatar for replies to create hierarchy */
.chat-bubble-wrapper.is-reply .chat-avatar img {
    width: 36px;
    height: 36px;
    margin-top: 6px; /* Aligns perfectly with the routing branch */
}

/* ---------------------------------- */

.chat-content {
    background: #FFFFFF;
    border: none; /* Soft Bubble Polish */
    border-radius: 20px;
    border-top-left-radius: 4px; /* Native chat bubble look */
    padding: 16px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.04);
    flex-grow: 1;
    max-width: 100%;
    z-index: 1;
}

.chat-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}

.chat-author {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-main, #1F2937);
    letter-spacing: -0.3px;
}

.chat-time {
    font-size: 0.8rem;
    color: #9CA3AF;
    font-weight: 500;
}

.chat-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 14px;
    white-space: pre-wrap; 
}

/* --- THE FLUID MEDIA FIX --- */
.chat-attachments {
    display: flex;
    flex-wrap: wrap; /* Allows natural wrapping */
    gap: 10px;
    margin-bottom: 12px;
}

.attached-img {
    max-width: 100%; 
    max-height: 550px; /* Prevents overly tall scroll takeovers */
    width: auto; 
    height: auto; 
    border-radius: 14px;
    object-fit: contain; /* Displays full image without chopping */
    background-color: #F8FAFC; 
    border: 1px solid rgba(225, 232, 237, 0.6);
}

.chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #F1F5F9;
    border: 1px solid transparent; 
    padding: 4px 10px;
    border-radius: 50px; 
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reaction-pill:hover {
    background: #E2E8F0;
    border-color: #CBD5E1;
    transform: translateY(-1px);
}

.reaction-emoji {
    width: 18px;
    height: 18px;
}


/* =========================================
   6. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 1024px) {
    .magazine-grid {
        column-count: 2; 
    }
}

@media (max-width: 768px) {
    .community-hero-banner {
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
    }

    .community-hero-banner .hero-content h1 {
        font-size: 2rem;
    }

    /* --- THE CHOPPED TABS FIX --- */
    .tab-navigation-wrapper {
        top: 74px; 
        margin-top: -20px; 
        padding: 16px; 
        background: rgba(248, 250, 252, 0.95); 
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(225, 232, 237, 0.8);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }

    .segmented-control {
        width: 100%;
        display: flex;
        box-shadow: none; 
    }

    .tab-btn {
        flex: 1; 
        justify-content: center;
        padding: 12px 16px; 
        font-size: 0.95rem;
    }
    
    .magazine-grid {
        column-count: 1; 
        gap: 24px; 
    }

    .card-body {
        padding: 16px; 
    }

    .masseur-title {
        font-size: 1.35rem; 
    }

    .radar-scores {
        gap: 6px;
        margin-bottom: 16px;
    }

    .score-pill {
        padding: 4px 8px; 
        font-size: 0.7rem;
    }

    .review-snippet.full-text p {
        font-size: 0.9rem; 
    }

    .chat-bubble-wrapper {
        gap: 12px;
    }

    /* --- MOBILE THREADING ADJUSTMENTS --- */
    .chat-bubble-wrapper.is-reply {
        margin-left: 28px; /* Tighter indentation so text isn't squeezed */
    }

    .chat-bubble-wrapper.is-reply::before {
        left: -20px;
        width: 16px;
    }

    .chat-avatar img {
        width: 40px;
        height: 40px;
    }

    .chat-bubble-wrapper.is-reply .chat-avatar img {
        width: 30px;
        height: 30px;
        margin-top: 4px;
    }
    /* ------------------------------------ */

    .chat-content {
        padding: 16px;
    }

    .chat-text {
        font-size: 1rem;
    }
}