/**
 * Investor FAQ System - Frontend Styles (Enhanced Version)
 * 投資人常見問答系統前台樣式 - 增強版本
 *
 * Features:
 * - Tab-based category navigation
 * - Enhanced search and year filter
 * - Responsive design for all devices
 * - Modern UI elements with smooth animations
 */

/* FAQ Container */
.investor-faq-template {
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
}

/* 側邊欄布局調整 */
.infinite-content-container .investor-faq-template {
    padding: 10px 0;
}

.infinite-content-container .investor-faq-template .container {
    padding: 0;
    max-width: none;
}

.investor-faq-template .container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
}

.page-title {
    font-size: 2.5em;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 15px;
}

.page-description {
    font-size: 1.1em;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* Statistics Section */
.ifs-stats-section {
    margin-bottom: 30px;
}

.ifs-stats-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.ifs-page-content {
    padding: 10px 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.ifs-stats-item {
    text-align: center;
    padding: 25px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.ifs-stats-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.ifs-stats-number {
    display: block;
    font-size: 2.5em;
    font-weight: 700;
    color: #283d86;
    margin-bottom: 8px;
}

.ifs-stats-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* 年份選擇區域 */
.ifs-year-selector-section {
    margin-bottom: 20px;
    padding: 0;
}

.ifs-year-selector-container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ifs-year-label {
    font-size: 16px;
    color: #333;
    white-space: nowrap;
}

.ifs-year-filter {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background: #ffffff;
    cursor: pointer;
    min-width: 100px;
}

.ifs-year-filter:focus {
    outline: none;
    border-color: #283d86;
}

/* 搜尋容器 */
.ifs-search-container {
    display: flex;
    margin-left: auto;
    border: 1px solid #ddd;
    border-radius: 20px;
    overflow: hidden;
    background: #ffffff;
}

.ifs-search-input {
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    width: 200px;
    outline: none;
}

.ifs-search-input::placeholder {
    color: #999;
}

.ifs-search-btn {
    background: #f8f9fa;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.ifs-search-btn:hover {
    background: #e9ecef;
}

.ifs-search-icon {
    font-size: 16px;
}

/* 分類標籤區域 - Carousel版本 */
.ifs-tabs-section {
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.ifs-tabs-carousel {
    display: flex;
    align-items: center;
    position: relative;
}

.ifs-category-tabs-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ifs-category-tabs {
    display: flex;
    gap: 0;
    background: transparent;
    padding: 0;
    border: none;
    transition: transform 0.3s ease;
    width: max-content;
}

.ifs-tabs-loading {
    padding: 20px;
    text-align: center;
    color: #666;
    width: 100%;
}

.ifs-tab-btn {
    padding: 15px 25px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #666;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-radius: 0;
    position: relative;
    flex-shrink: 0;
}

.ifs-tab-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.ifs-tab-btn.active {
    background: transparent;
    color: #283d86 !important;
    border-bottom-color: #283d86 !important;
    font-weight: 700;
    border-bottom-width: 4px;
}

.ifs-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: #ffffff;
}

/* Carousel 導航按鈕 */
.ifs-carousel-btn {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    flex-shrink: 0;
}

.ifs-carousel-btn:hover {
    background: #e9ecef;
    border-color: #d0d7de;
}

.ifs-carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ifs-carousel-btn:disabled:hover {
    background: #f8f9fa;
    border-color: #e0e0e0;
}

.ifs-carousel-prev {
    margin-right: 10px;
}

.ifs-carousel-next {
    margin-left: 10px;
}

.ifs-carousel-icon {
    font-size: 20px;
    font-weight: bold;
    color: #666;
    line-height: 1;
}

.ifs-tab-count {
    display: none;
    /* 隱藏計數 */
}

/* FAQ Container */
.ifs-faq-container {
    margin-top: 20px;
}

/* FAQ列表樣式 - Q&A風格 */
.ifs-faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ifs-faq-item {
    background: #ffffff;
    border: none;
    border-bottom: 1px solid #e5e5e5;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ifs-faq-item:last-child {
    border-bottom: none;
}

.ifs-faq-item:hover {
    background: #fafafa;
}

/* FAQ問題區域 */
.ifs-faq-question {
    padding: 20px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 0;
    border-bottom: none;
}

.ifs-question-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
    padding-left: 20px;
}

/* Q圖標 */
.ifs-q-icon {
    background: #283d86;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 2px;
}

.ifs-q-icon.answer {
    background: #ffb900;
    color: white;
}

/* 問題文字 */
.ifs-question-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    line-height: 1.5;
    padding-right: 20px;
}

/* 展開/收合按鈕 */
.ifs-toggle-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.ifs-toggle-btn:hover {
    color: #283d86;
}

.ifs-toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.ifs-faq-question[data-expanded="true"] .ifs-toggle-icon {
    transform: rotate(180deg);
}

/* FAQ答案區域 */
.ifs-faq-answer {
    border-top: none;
    background: #ffffff;
    display: flex;
    /* 與Q圖標對齊 */
    animation: slideDown 0.3s ease-out;
}
.ifs-answer-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
    padding-top: 20px;
    padding-bottom: 10px;
    padding-left: 20px;
}

.ifs-answer-content {
    /* padding: 15px 0 20px 0; */
    color: #666;
    line-height: 1.6;
    font-size: 15px;
    /* padding-top: 20px; */
}

.ifs-answer-content h1,
.ifs-answer-content h2,
.ifs-answer-content h3,
.ifs-answer-content h4,
.ifs-answer-content h5,
.ifs-answer-content h6 {
    color: #1a1a1a;
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.ifs-answer-content p {
    margin-bottom: 16px;
}

.ifs-answer-content ul,
.ifs-answer-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.ifs-answer-content li {
    margin-bottom: 8px;
}

.ifs-answer-content a {
    color: #283d86;
    text-decoration: none;
    font-weight: 500;
}

.ifs-answer-content a:hover {
    text-decoration: underline;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    to {
        opacity: 1;
        max-height: 1000px;
        padding-top: 24px;
        padding-bottom: 24px;
    }
}

/* Buttons */
.ifs-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ifs-btn-primary {
    background: #007cba;
    color: white;
}

.ifs-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.ifs-btn-secondary {
    background: #6c757d;
    color: white;
}

.ifs-btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

/* Loading */
.ifs-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.ifs-loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.ifs-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* No Results */
.ifs-no-results,
.ifs-no-results-message {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

.ifs-no-results-content {
    max-width: 400px;
    margin: 0 auto;
}

.ifs-no-results-icon {
    font-size: 3em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.ifs-no-results-content h3 {
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.ifs-no-results-content p {
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 25px;
}

/* FAQ List */
.ifs-faq-list {
    margin-top: 20px;
}

.ifs-faq-item {
    border-bottom: 1px solid #e0e0e0;
    /* margin-bottom: 16px; */
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.ifs-faq-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}


.ifs-faq-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s ease;
    
}

.ifs-faq-header:hover {
    background: #f8f9fa;
}

.ifs-faq-question {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ifs-featured-icon {
    font-size: 16px;
    color: #ffb900;
}

.ifs-year-badge {
    background: #007cba;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-left: auto;
}

.ifs-toggle-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 15px;
    flex-shrink: 0;
}

.ifs-toggle-btn:hover {
    background: #f0f0f0;
    color: #007cba;
}

.ifs-toggle-icon {
    transition: transform 0.3s ease;
}

.ifs-faq-item.ifs-expanded .ifs-toggle-icon {
    transform: rotate(45deg);
}

.ifs-faq-item.ifs-expanded {
     background-color: #F8F3EC;
}

.ifs-faq-answer {
    border-top: 1px solid #e0e0e0;
    animation: ifs-slideDown 0.3s ease-out;
}

.ifs-answer-content {
    color: #555;
    line-height: 1.6;
}

.ifs-answer-content h1,
.ifs-answer-content h2,
.ifs-answer-content h3,
.ifs-answer-content h4,
.ifs-answer-content h5,
.ifs-answer-content h6 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.ifs-answer-content p {
    margin-bottom: 15px;
}

.ifs-answer-content ul,
.ifs-answer-content ol {
    margin-bottom: 15px;
    padding-left: 30px;
}

.ifs-answer-content li {
    margin-bottom: 5px;
}

.ifs-answer-content a {
    color: #007cba;
    text-decoration: none;
}

.ifs-answer-content a:hover {
    text-decoration: underline;
}

@keyframes ifs-slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* No Results */
.ifs-no-results,
.ifs-no-results-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.ifs-no-results-content h3 {
    font-size: 28px !important;
}

/* Single FAQ Page */
.ifs-single-faq {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.ifs-single-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.ifs-single-question {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ifs-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #666;
    font-size: 14px;
}

.ifs-meta-label {
    font-weight: 600;
}

.ifs-categories a {
    color: #007cba;
    text-decoration: none;
}

.ifs-categories a:hover {
    text-decoration: underline;
}

.ifs-single-content {
    margin-bottom: 40px;
}

.ifs-answer-content,
.ifs-additional-content {
    font-size: 16px;
    line-height: 1.7;
    color: #444;
}

/* Navigation */
.ifs-post-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 20px;
}

.ifs-nav-previous,
.ifs-nav-next {
    flex: 1;
}

.ifs-nav-previous a,
.ifs-nav-next a {
    display: block;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.ifs-nav-previous a:hover,
.ifs-nav-next a:hover {
    background: #f8f9fa;
    border-color: #007cba;
}

.ifs-nav-next {
    text-align: right;
}

.ifs-nav-subtitle {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 5px;
}

.ifs-nav-title {
    display: block;
    font-weight: 500;
    line-height: 1.4;
}

.ifs-back-to-list {
    text-align: center;
}

/* Archive Page */
.archive-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.archive-title {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.archive-description {
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .investor-faq-template .container {
        padding: 0 15px;
    }

    .ifs-stats-container {
        gap: 20px;
    }

    .ifs-stats-item {
        min-width: 120px;
        padding: 20px 25px;
    }
}

@media (max-width: 768px) {
    .investor-faq-template {
        padding: 15px 0;
    }

    .page-title {
        font-size: 2em;
    }

    .page-description {
        font-size: 1em;
    }

    /* 年份選擇器響應式 */
    .ifs-year-selector-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .ifs-search-container {
        margin-left: 0;
        width: 100%;
    }

    .ifs-search-input {
        width: 100%;
    }

    /* 分類標籤響應式 */
    .ifs-category-tabs {
        gap: 0;
        justify-content: flex-start;
    }

    .ifs-tab-btn {
        padding: 12px 18px;
        font-size: 15px;
    }

    /* Carousel 響應式 */
    .ifs-carousel-btn {
        width: 36px;
        height: 36px;
    }

    .ifs-carousel-icon {
        font-size: 18px;
    }

    .ifs-carousel-prev {
        margin-right: 8px;
    }

    .ifs-carousel-next {
        margin-left: 8px;
    }

    /* FAQ項目響應式 */
    .ifs-faq-question {
        padding: 16px 0;
    }

    .ifs-question-header {
        gap: 12px;
    }

    .ifs-q-icon {
        width: 22px;
        height: 22px;
        font-size: 13px;
    }

    .ifs-question-text {
        font-size: 15px;
        padding-right: 15px;
    }

    .ifs-toggle-btn {
        width: 22px;
        height: 22px;
    }

    .ifs-toggle-icon {
        font-size: 11px;
    }

    .ifs-faq-answer {
        padding-left: 34px;
    }

    .ifs-answer-content {
        font-size: 14px;
        padding: 12px 0 16px 0;
    }

    .ifs-no-results,
    .ifs-no-results-message {
        padding: 60px 15px;
    }

    .ifs-no-results-icon {
        font-size: 2.5em;
    }

    .ifs-no-results-content h3 {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.8em;
    }

    .ifs-year-selector-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .ifs-search-input {
        font-size: 16px;
        /* Prevent iOS zoom */
    }

    .ifs-tab-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Carousel 小螢幕樣式 */
    .ifs-carousel-btn {
        width: 32px;
        height: 32px;
    }

    .ifs-carousel-icon {
        font-size: 16px;
    }

    .ifs-carousel-prev {
        margin-right: 6px;
    }

    .ifs-carousel-next {
        margin-left: 6px;
    }

    .ifs-faq-header,
    .ifs-faq-question {
        padding: 15px;
        position: relative;
    }

    .ifs-faq-question h3 {
        font-size: 1em;
        padding-right: 50px;
    }

    .ifs-toggle-btn {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
    }

    .ifs-toggle-icon {
        font-size: 18px;
    }

    .ifs-answer-content {
        padding: 15px;
        font-size: 13px;
    }

    .ifs-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .ifs-no-results,
    .ifs-no-results-message {
        padding: 40px 15px;
    }

    .ifs-no-results-icon {
        font-size: 2em;
        margin-bottom: 15px;
    }

    .ifs-no-results-content h3 {
        font-size: 1.2em;
    }
}