/* Common styles */
.faq-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.faq-list {
    margin-top: 20px;
}

.faq-item {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
    transition: box-shadow 0.3s ease;
}

.faq-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #f8f8f8;
    cursor: pointer !important;
    transition: background-color 0.3s ease;
    user-select: none;
    border-bottom: 1px solid #eee;
}

.faq-question:hover {
    background-color: #f0f0f0;
}

.question-text {
    flex: 1;
    font-weight: 600;
    padding-right: 15px;
    line-height: 1.4;
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #f8f8f8;
    cursor: pointer !important;
    transition: background-color 0.3s ease;
    user-select: none;
    border-bottom: 1px solid #eee;
}

.faq-question:hover {
    background-color: #f0f0f0;
}

/* Visual feedback when active */
.faq-item.active .faq-question {
    background-color: #e8f4fd;
    border-bottom: 1px solid #2fb5d2;
}

/* Icon styles with proper fallbacks */
.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.toggle-icon span {
    font-size: 24px;
    color: #2fb5d2;
    transition: all 0.3s ease;
    line-height: 1;
    font-style: normal;
    font-weight: bold;
    font-family: Arial, sans-serif;
    display: block;
}

/* Icon visibility logic - CORRECTED */
.faq-item .toggle-icon .plus {
    display: block;
}

.faq-item .toggle-icon .minus {
    display: none;
}

.faq-item.active .toggle-icon .plus {
    display: none;
}

.faq-item.active .toggle-icon .minus {
    display: block;
}

.faq-answer {
    max-height: 0px;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    background-color: #fff;
}

/* FIXED: Ensure proper formatting for HTML content in questions */
.question-text {
    flex: 1;
    font-weight: 600;
    padding-right: 15px;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
    display: block !important; /* Force block display */
}

.question-text p {
    margin: 0 0 8px 0;
    display: block !important;
}

.question-text p:last-child {
    margin-bottom: 0;
}

.question-text ul {
    margin: 8px 0 !important;
    padding-left: 25px !important;
    list-style-type: disc !important;
    list-style-position: outside !important;
    display: block !important;
    width: 100% !important;
}

.question-text ol {
    margin: 8px 0 !important;
    padding-left: 25px !important;
    list-style-type: decimal !important;
    list-style-position: outside !important;
    display: block !important;
    width: 100% !important;
}

.question-text li {
    margin-bottom: 4px !important;
    display: list-item !important;
    line-height: 1.4;
    list-style: inherit !important;
    width: 100% !important;
    clear: both !important;
}

.question-text strong,
.question-text b {
    font-weight: bold;
}

.question-text em,
.question-text i {
    font-style: italic;
}

.question-text a {
    color: #2fb5d2;
    text-decoration: underline;
}

.question-text a:hover {
    color: #2592a9;
}

/* Support for span tags with inline styles (colors, backgrounds, etc.) */
.question-text span {
    display: inline;
}

.question-text h1,
.question-text h2,
.question-text h3,
.question-text h4,
.question-text h5,
.question-text h6 {
    margin: 10px 0 8px 0;
    font-weight: bold;
    display: block !important;
}

/* CRITICAL: Override any flex container issues */
.faq-question .question-text ul,
.faq-question .question-text ol {
    flex-direction: column !important;
    flex-wrap: wrap !important;
}

.faq-question .question-text li {
    flex-basis: 100% !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
}

/* Enhanced answer content formatting */
.question-text p {
    margin: 0 0 8px 0;
    display: inline;
}

.question-text p:last-child {
    margin-bottom: 0;
}

.question-text ul,
.question-text ol {
    margin: 5px 0;
    padding-left: 20px;
    display: inline-block;
}

.question-text li {
    margin-bottom: 3px;
    display: list-item;
    line-height: 1.3;
}

.question-text strong,
.question-text b {
    font-weight: bold;
}

.question-text em,
.question-text i {
    font-style: italic;
}

.question-text a {
    color: #2fb5d2;
    text-decoration: underline;
}

.question-text a:hover {
    color: #2592a9;
}

.question-text br {
    display: inline;
    white-space: pre-line;
}

.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.toggle-icon i {
    font-size: 24px;
    color: #2fb5d2;
    transition: transform 0.3s ease;
    line-height: 1;
}

/* Icon styles with proper fallbacks */
.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.toggle-icon span {
    font-size: 24px;
    color: #2fb5d2;
    transition: transform 0.3s ease;
    line-height: 1;
    font-style: normal;
    font-weight: bold;
    font-family: Arial, sans-serif;
    display: block;
}

/* Icon visibility logic - CORRECTED */
.faq-item .toggle-icon .plus {
    display: block;
}

.faq-item .toggle-icon .minus {
    display: none;
}

.faq-item.active .toggle-icon .plus {
    display: none;
}

.faq-item.active .toggle-icon .minus {
    display: block;
}

.faq-answer {
    max-height: 0px;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    background-color: #fff;
}

/* Ensure proper formatting for HTML content */
.answer-content {
    padding: 15px;
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.answer-content p {
    margin: 0 0 15px 0;
    display: block;
}

.answer-content p:last-child {
    margin-bottom: 0;
}

.answer-content ul {
    margin: 15px 0;
    padding-left: 25px;
    list-style-type: disc;
    display: block;
}

.answer-content ol {
    margin: 15px 0;
    padding-left: 25px;
    list-style-type: decimal;
    display: block;
}

.answer-content li {
    margin-bottom: 8px;
    display: list-item;
    line-height: 1.5;
}

.answer-content strong,
.answer-content b {
    font-weight: bold;
}

.answer-content em,
.answer-content i {
    font-style: italic;
}

.answer-content a {
    color: #2fb5d2;
    text-decoration: underline;
}

.answer-content a:hover {
    color: #2592a9;
}

.answer-content h1,
.answer-content h2,
.answer-content h3,
.answer-content h4,
.answer-content h5,
.answer-content h6 {
    margin: 20px 0 15px 0;
    font-weight: bold;
    display: block;
}

.answer-content h1 { font-size: 1.5em; }
.answer-content h2 { font-size: 1.3em; }
.answer-content h3 { font-size: 1.1em; }

.answer-content br {
    display: block;
    margin: 5px 0;
    content: "";
}

/* Force block display for key elements */
.answer-content div,
.answer-content p,
.answer-content ul,
.answer-content ol,
.answer-content h1,
.answer-content h2,
.answer-content h3,
.answer-content h4,
.answer-content h5,
.answer-content h6 {
    display: block !important;
}

/* Link styles */
.faq-link-container {
    display: inline-block;
    margin: 0 15px;
}

.faq-link {
    color: #2fb5d2;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.faq-link:hover {
    color: #2592a9;
}

.faq-text {
    font-size: 16px;
}

/* Responsive styles */
@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }
    
    .faq-container {
        padding: 10px;
    }
    
    .faq-question {
        padding: 12px;
    }
    
    .question-text {
        font-size: 14px;
    }
    
    .toggle-icon {
        width: 28px;
        height: 28px;
    }
    
    .toggle-icon i {
        font-size: 20px;
    }
}

@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}