/* Custom CSS cho Rank Math FAQ Block - Collapsible Style */
/* Optimized for Performance & Smooth UX */

/* Container chính */
.rank-math-block {
    max-width: 100%;
    margin: 0 auto;
}

.rank-math-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Mỗi FAQ item */
.rank-math-list-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    /* GPU acceleration cho smooth animation */
    will-change: box-shadow;
    /* Chỉ transition box-shadow thôi, tránh transition 'all' */
    transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.rank-math-list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Câu hỏi - heading */
.rank-math-question {
    margin: 0;
    padding: 20px 60px 20px 24px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: #1f2937;
    cursor: pointer;
    position: relative;
    user-select: none;
    /* Smooth transition cho color */
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon mũi tên dropdown */
.rank-math-question::after {
    content: '';
    position: absolute;
    right: 24px;
    top: 50%;
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    /* GPU acceleration */
    will-change: transform;
    transform: translateY(-50%) rotate(0deg);
    /* Cubic-bezier mượt mà hơn */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effect cho câu hỏi */
.rank-math-question:hover {
    color: #3da578;
}

.rank-math-question:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233da578'%3E%3Cpath d='M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z'/%3E%3C/svg%3E");
}

/* Câu trả lời - wrapper bên ngoài */
/* Technique from Shadcn UI - JS calculates max-height dynamically */
.rank-math-answer {
    /* Ẩn hoàn toàn khi đóng */
    max-height: 0;
    overflow: hidden;
    /* Smooth transition - JS sẽ set max-height chính xác */
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

/* Paragraph bên trong answer */
.rank-math-answer p {
    margin: 0;
    /* Padding khớp với question */
    padding: 8px 60px 20px 24px;
    font-size: 16px;
    line-height: 1.7;
    color: #4b5563;
    /* Subtle fade in */
    opacity: 0;
    transition: opacity 0.2s ease-out 0.1s;
}

/* Trạng thái khi FAQ được mở */
/* max-height sẽ được set bởi JavaScript dựa trên scrollHeight */
.rank-math-list-item.active .rank-math-answer p {
    opacity: 1;
}

.rank-math-list-item.active .rank-math-question::after {
    transform: translateY(-50%) rotate(180deg);
}

.rank-math-list-item.active .rank-math-question {
    color: #3da578;
}

/* Responsive cho tablet */
@media (max-width: 768px) {
    .rank-math-question {
        padding: 18px 50px 18px 20px;
        font-size: 17px;
    }

    .rank-math-question::after {
        right: 20px;
        width: 22px;
        height: 22px;
    }

    .rank-math-answer p {
        padding: 8px 50px 18px 20px;
        font-size: 15px;
    }
}

/* Responsive cho mobile */
@media (max-width: 480px) {
    .rank-math-list {
        gap: 12px;
    }

    .rank-math-question {
        padding: 16px 45px 16px 16px;
        font-size: 16px;
    }

    .rank-math-question::after {
        right: 16px;
        width: 20px;
        height: 20px;
    }

    .rank-math-answer p {
        padding: 6px 45px 16px 16px;
        font-size: 14px;
    }
}

/* Tối ưu cho reduced motion (accessibility) */
@media (prefers-reduced-motion: reduce) {
    .rank-math-list-item,
    .rank-math-question,
    .rank-math-question::after,
    .rank-math-answer,
    .rank-math-answer p {
        transition: none;
    }
}

