/**
 * AI Questions Frontend Styles
 * OS 01-Dec-2025
 * 
 * Styles for the AI-generated questions and answers section on single posts
 */

/* Section Container */
.wtd-ai-questions-section {
    margin: 3rem 0;
    padding: 0;
}

.wtd-ai-questions-wrapper {
    background: linear-gradient(135deg, #fffbf7 0%, #faf4ee 100%);
    border-radius: 16px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.wtd-ai-questions-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #fae9d6 0%, #f5dbbd 50%, #f9e2c7 100%);
}

/* Header - Clickable Section Toggle */
.wtd-ai-questions-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
    transition: margin-bottom 0.3s ease;
}

.wtd-ai-questions-section.expanded .wtd-ai-questions-header {
    margin-bottom: 2rem;
}

.wtd-ai-questions-header:hover {
    opacity: 0.9;
}

.wtd-ai-questions-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #1a1a1a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.wtd-ai-questions-icon svg {
    width: 24px;
    height: 24px;
}

.wtd-ai-questions-title-wrap {
    flex: 1;
}

.wtd-ai-questions-title {
    font-family: 'Biennale', 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.02em;
}

.wtd-ai-questions-subtitle {
    font-family: 'Manrope', sans-serif;
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    font-weight: 400;
}

/* Section Chevron - matches wtd-view-chevron style */
.wtd-ai-section-chevron {
    font-size: 46px;
    color: #6b6b6b;
    transition: transform 0.3s ease;
    display: inline-block;
}

.wtd-ai-questions-section.expanded .wtd-ai-section-chevron {
    transform: rotate(180deg);
}

/* Subtitle text switching */
.wtd-ai-collapsed-text,
.wtd-ai-expanded-text {
    display: none;
}

.wtd-ai-questions-section.collapsed .wtd-ai-collapsed-text {
    display: inline;
}

.wtd-ai-questions-section.expanded .wtd-ai-expanded-text {
    display: inline;
}

/* Questions List */
.wtd-ai-questions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Question Item */
.wtd-ai-question-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.wtd-ai-question-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.wtd-ai-question-item.expanded {
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.1);
}

/* Question Header (Clickable) */
.wtd-ai-question-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.wtd-ai-question-header:hover {
    background: #fafafa;
}

.wtd-ai-question-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Manrope', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
}

.wtd-ai-question-text {
    flex: 1;
    font-family: 'Manrope', sans-serif;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding-top: 2px;
}

/* Toggle Icon */
.wtd-ai-question-toggle {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color 0.2s ease, transform 0.3s ease;
}

.wtd-ai-question-header:hover .wtd-ai-question-toggle {
    color: #1a1a1a;
}

.wtd-icon-collapse {
    display: none;
}

.wtd-ai-question-item.expanded .wtd-icon-expand {
    display: none;
}

.wtd-ai-question-item.expanded .wtd-icon-collapse {
    display: block;
}

/* Answer Container */
.wtd-ai-answer-container {
    border-top: 1px solid #f0f0f0;
}

.wtd-ai-answer-content {
    padding: 1.5rem;
    background: linear-gradient(180deg, #f8f9fa 0%, #fff 100%);
}

.wtd-ai-answer-text {
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #444;
}

.wtd-ai-answer-text p {
    margin: 0 0 1rem 0;
}

.wtd-ai-answer-text p:last-child {
    margin-bottom: 0;
}

/* Answer Footer */
.wtd-ai-answer-footer {
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #f0f0f0;
}

.wtd-ai-answer-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Manrope', sans-serif;
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wtd-ai-answer-note svg {
    opacity: 0.6;
}

/* Loading State */
.wtd-ai-answer-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    font-family: 'Manrope', sans-serif;
    font-size: 0.9rem;
    color: #666;
}

.wtd-ai-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: wtd-spin 0.8s linear infinite;
}

@keyframes wtd-spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.wtd-ai-answer-error {
    background: #fff5f5;
    color: #c53030;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin: 0;
}

/* Section Footer */
.wtd-ai-questions-footer {
    margin-top: 1.25rem;
    padding-top: 0;
    border-top: none;
    text-align: right;
}

.wtd-ai-questions-note {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Manrope', sans-serif !important;
    font-size: 0.8rem !important;
    color: #bbb;
    margin: 0;
    text-transform: uppercase !important;
    letter-spacing: 0.01em;
    font-weight: 400;
}

.wtd-ai-questions-note svg {
    width: 10px;
    height: 10px;
    color: #ccc;
    opacity: 0.6;
}

/* Animation on load */
@keyframes wtd-question-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wtd-ai-question-item {
    animation: wtd-question-fade-in 0.4s ease forwards;
}

.wtd-ai-question-item:nth-child(1) { animation-delay: 0.1s; }
.wtd-ai-question-item:nth-child(2) { animation-delay: 0.2s; }
.wtd-ai-question-item:nth-child(3) { animation-delay: 0.3s; }
.wtd-ai-question-item:nth-child(4) { animation-delay: 0.4s; }
.wtd-ai-question-item:nth-child(5) { animation-delay: 0.5s; }

/* Answer reveal animation */
@keyframes wtd-answer-reveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wtd-ai-answer-text {
    animation: wtd-answer-reveal 0.4s ease forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .wtd-ai-questions-wrapper {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .wtd-ai-questions-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        position: relative;
    }
    
    .wtd-ai-section-chevron {
        position: absolute;
        right: 0;
        top: 0;
        margin-top: 0;
        font-size: 14px;
    }
    
    .wtd-ai-questions-icon {
        width: 40px;
        height: 40px;
    }
    
    .wtd-ai-questions-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .wtd-ai-questions-title-wrap {
        width: calc(100% - 90px);
    }
    
    .wtd-ai-questions-title {
        font-size: 1.25rem;
    }
    
    .wtd-ai-question-header {
        padding: 1rem;
    }
    
    .wtd-ai-question-text {
        font-size: 1rem;
    }
    
    .wtd-ai-answer-content {
        padding: 1rem;
    }
    
    .wtd-ai-answer-footer {
        padding: 0.75rem 1rem;
    }
}
