/* AI中文新聞網站自定義樣式 */

/* 基本設定 */
body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', sans-serif;
    line-height: 1.6;
    background-color: #ffffff;
    background-image: url('../images/bg_main.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #212529;
}

/* 導航欄 */
.navbar-brand {
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: rgb(255, 118, 0) !important;
}

/* 橫幅區域 */
.hero-banner {
    background: linear-gradient(135deg, rgba(255, 118, 0, 0.1) 0%, rgba(255, 118, 0, 0.2) 100%);
    color: rgb(255, 118, 0);
    padding: 4rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.hero-banner h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-banner p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 新聞卡片 */
.news-card {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    overflow: hidden;
    background-color: #ffffff;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    background-color: rgb(255, 241, 223) !important;
    border-color: rgb(255, 118, 0) !important;
}

.news-card .card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-card:hover .card-img-top {
    transform: scale(1.05);
}

.news-card .card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.news-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.8rem;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.news-card:hover .card-title {
    color: rgb(255, 118, 0) !important;
}

.news-card .card-text {
    color: #555555;
    font-size: 0.9rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.news-meta .badge {
    font-size: 0.7rem;
    margin-right: 0.3rem;
}

/* 分類標籤 */
.category-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.category-badge:hover {
    background-color: rgb(255, 241, 223) !important;
    border-color: rgb(255, 118, 0) !important;
    color: rgb(255, 118, 0) !important;
    text-decoration: none;
}

/* 橫幅輪播 */
.banner-carousel {
    margin-bottom: 2rem;
}

.banner-carousel .carousel-item {
    position: relative;
}

.banner-carousel .banner-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
}

.banner-carousel .banner-link {
    display: block;
    text-decoration: none;
}

.banner-carousel .banner-link:hover {
    text-decoration: none;
}

.banner-carousel .carousel-indicators {
    bottom: 10px;
}

.banner-carousel .carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 4px;
}

.banner-carousel .carousel-control-prev,
.banner-carousel .carousel-control-next {
    width: 5%;
}

/* 分頁 */
.pagination .page-link {
    color: rgb(255, 118, 0);
    border-color: #dee2e6;
    padding: 0.5rem 0.75rem;
}

.pagination .page-link:hover {
    color: rgb(200, 90, 0);
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    color: #ffffff;
    background-color: rgb(255, 118, 0);
    border-color: rgb(255, 118, 0);
}

.dropdown-item.active, .dropdown-item:active{
    background-color: rgb(255, 118, 0) !important;
}

/* 搜索結果 */
.search-highlight {
    background-color: #fff3cd;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

/* 新聞詳情頁 */
.news-detail .news-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.news-detail .news-meta {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid rgb(255, 118, 0);
}

.news-detail .news-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333333;
}

.news-detail .news-content p {
    margin-bottom: 1.5rem;
}

.news-detail .news-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

/* 相關新聞 */
.related-news .card {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.related-news .card:hover {
    transform: translateY(-3px);
}

.related-news .card-title {
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 側邊欄 */
.sidebar .card {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    background-color: #ffffff;
}

.sidebar .card-header {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 118, 0, 0.3);
    border-radius: 50%;
    border-top-color: rgb(255, 118, 0);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 懶載入圖片 */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazy.loaded {
    opacity: 1;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .hero-banner h1 {
        font-size: 2rem;
    }
    
    .hero-banner p {
        font-size: 1rem;
    }
    
    .news-card .card-img-top {
        height: 150px;
    }
    
    .news-detail .news-title {
        font-size: 1.5rem;
    }
    
    .news-detail .news-content {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    
    .news-card .card-body {
        padding: 1rem;
    }
    
    .hero-banner {
        padding: 2rem 0;
    }
}

/* 移除深色模式，統一使用淺色主題 */

/* 無障礙設計 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦點樣式 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgb(255, 118, 0);
    outline-offset: 2px;
}

/* 自定義橙色主題 - 覆蓋Bootstrap默認藍色 */
.text-primary {
    color: rgb(255, 118, 0) !important;
}

.btn-primary {
    background-color: rgb(255, 241, 223) !important;
    border-color: rgb(255, 118, 0) !important;
    color: rgb(255, 118, 0) !important;
}

.btn-primary:hover {
    background-color: rgb(255, 118, 0) !important;
    border-color: rgb(200, 90, 0) !important;
    color: rgb(255, 255, 255) !important;
}

.btn-primary:focus {
    background-color: rgb(255, 118, 0) !important;
    border-color: rgb(200, 90, 0) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 118, 0, 0.25) !important;
    color: rgb(255, 255, 255) !important;
}

.bg-primary {
    background-color: rgb(255, 118, 0) !important;
}

.badge.bg-primary {
    background-color: rgb(255, 118, 0) !important;
}

.btn-outline-primary {
    color: rgb(255, 118, 0) !important;
    border-color: rgb(255, 118, 0) !important;
}

.btn-outline-primary:hover {
    background-color: rgb(255, 118, 0) !important;
    border-color: rgb(255, 118, 0) !important;
    color: white !important;
}

/* Select Box 橙色 Hover 樣式 */
.form-select:hover {
    border-color: rgb(255, 118, 0) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 118, 0, 0.25) !important;
}

.form-select:focus {
    border-color: rgb(255, 118, 0) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 118, 0, 0.25) !important;
}

.form-select option:hover {
    background-color: rgba(255, 118, 0, 0.1) !important;
    color: rgb(255, 118, 0) !important;
}

/* Header Menu 分類下拉選單橙色 Hover 樣式 */
.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus {
    background-color: rgba(255, 118, 0, 0.1) !important;
    color: rgb(255, 118, 0) !important;
}

.navbar .dropdown:hover .dropdown-menu {
    display: block !important;
}

.navbar .dropdown-menu {
    margin-top: 0;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
}

/* Footer 法律聲明 Hover 效果 */
.hover-primary:hover {
    color: rgb(255, 118, 0) !important;
    transition: color 0.2s ease;
}

footer h6 {
    font-weight: 600;
}

footer ul li a {
    font-size: 14px;
    color: rgb(59, 59, 59) !important;
}
footer ul li a:hover {
    color: rgb(255, 118, 0) !important;
    transition: color 0.2s ease;
}

/* ===== Chatbot 頁面 ===== */
.chatbot-row .col-lg-8 > .card {
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

.chatbot-row .col-lg-8 > .card > .card-body {
    min-height: 0;
}

.chatbot-row .card-body.p-0 .news-card {
    height: auto;
}

.chatbot-row .card-body.p-0 .news-card .news-meta {
    margin-top: 0;
    padding-top: 0.5rem;
    border-top: none;
}

.chat-container {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    background-color: #f8f9fa;
    margin-bottom: 1rem;
}

@media (max-width: 991.98px) {
    .chatbot-row .col-lg-8 > .card {
        max-height: none;
    }
    .chat-container {
        flex: none;
        min-height: 350px;
        max-height: 60vh;
    }
}

.chat-message {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
}

.user-message .message-content {
    color: #000;
    border-bottom-right-radius: 0.25rem;
    background-color: rgb(255, 241, 223) !important;
    border: 1px solid rgb(255, 118, 0) !important;
}

.bot-message .message-content {
    background-color: white;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 0.25rem;
}

.chat-input-container {
    position: relative;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.typing-indicator {
    display: none;
    padding: 0.75rem 1rem;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
    max-width: 70%;
}

.typing-indicator.show {
    display: block;
}

.typing-dots {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6c757d;
    animation: typing 1.4s infinite ease-in-out;
    margin: 0 2px;
}

.typing-dots:nth-child(1) { animation-delay: -0.32s; }
.typing-dots:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.news-results {
    margin-top: 1rem;
}

.news-result-item {
    display: block;
    text-decoration: none;
    color: inherit;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.news-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    background-color: rgb(255, 241, 223);
    border-color: rgb(255, 118, 0);
    text-decoration: none;
    color: inherit;
}

.news-result-item:hover .news-result-title {
    color: rgb(255, 118, 0);
}

.news-result-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
    transition: color 0.3s ease;
}

.news-result-meta {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.news-result-summary {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

.more-news-buttons {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed #dee2e6;
    text-align: center;
}

.more-news-buttons .btn {
    margin: 0 0.5rem;
}

/* 印刷樣式 */
@media print {
    .navbar,
    .sidebar,
    .pagination,
    footer {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
    }
    
    .news-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}
