@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@700&display=swap');

/* 預載入字體 */
@font-face {
    font-family: 'Noto Sans TC';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: local('Noto Sans TC Medium'), local('NotoSansTC-Medium');
}

@font-face {
    font-family: 'Noto Sans TC';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local('Noto Sans TC Bold'), local('NotoSansTC-Bold');
}

html {
    /* 始終保留滾動條空間，防止模態框開關時導致的寬度變化和抖動 */
    overflow-y: scroll;
    scrollbar-width: thin; /* Firefox */
}

body {
    font-family: "Microsoft JhengHei", "微軟正黑體", arial, sans-serif !important;
    background: #f3f3f3;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* 保证页面至少撑满视窗高度 */
    width: 100%;
    /* 防止 Bootstrap 模態框開關時的抖動 */
    padding-right: 0 !important;
}

/* 防止 Bootstrap 模態框開啟時自動添加的 padding-right */
body.modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}

.modal {
    padding-right: 0 !important;
}

.header {
    background: linear-gradient(
        135deg,
        rgba(26, 67, 119, 0.98) 0%,
        rgba(34, 85, 147, 1) 50%,
        rgba(26, 67, 119, 0.98) 100%
    );
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
                0 8px 16px rgba(26, 67, 119, 0.15),
                inset 0 -1px 0 rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.7rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    /* 防止模態框開關時的寬度抖動 */
    padding-right: 0 !important;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 20%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.15) 80%,
        transparent 100%
    );
    pointer-events: none;
}

.header.scrolled {
    background: linear-gradient(
        135deg,
        rgba(26, 67, 119, 0.85) 0%,
        rgba(34, 85, 147, 0.88) 50%,
        rgba(26, 67, 119, 0.85) 100%
    );
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.18),
                0 12px 24px rgba(26, 67, 119, 0.12),
                inset 0 -1px 0 rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header .container-fluid {
    padding-left: 20px;
    padding-right: 20px;
    max-width: 1400px;
}

.header .navbar-nav {
    gap: 0.5rem;
}

.header .nav-link {
    display: inline-block;
    padding: 0.9rem 1.1rem;
    color: rgba(255, 255, 255, 0.88) !important;
    font-size: 0.98rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.header .nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.15));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.header .nav-link:hover {
    color: #ffffff !important;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.14) 0%,
        rgba(255, 255, 255, 0.08) 100%
    );
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.header .nav-link:hover::before {
    opacity: 1;
}

.header .nav-link.active {
    font-weight: 600;
    color: #ffffff !important;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.12) 100%
    );
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.25),
                inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.header .nav-link.active::before {
    opacity: 1;
}

.header .nav-link .badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(30%, -30%);
    font-size: 0.7rem;
    padding: 0.35em 0.65em;
}

.navbar-brand {
    font-family: 'Noto Sans TC', "Microsoft JhengHei", "微軟正黑體", sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: -10px;
}

@media (min-width: 1400px) {
    .navbar-brand {
        margin-left: calc(((100vw - 1400px) / 2 + 10px) * -1);
    }
}

.navbar-brand:hover {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.navbar-brand img {
    width: 36px;
    height: 34px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.navbar-brand:hover img {
    transform: scale(1.08) rotate(-3deg);
    filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.4));
}

.navbar-brand .h1 {
    margin-bottom: 0;
    font-size: 1.6rem;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4),
                 0 4px 16px rgba(26, 67, 119, 0.5),
                 0 0 24px rgba(255, 255, 255, 0.15);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.navbar-brand:hover .h1 {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4),
                 0 4px 16px rgba(26, 67, 119, 0.6),
                 0 0 32px rgba(255, 255, 255, 0.3);
}

.header .dropdown-menu {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(245, 248, 252, 0.96) 100%
    );
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15),
                0 4px 16px rgba(26, 67, 119, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    margin-top: 0.6rem;
    padding: 0.6rem;
    min-width: 200px;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
    pointer-events: none;
}

.header .dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 248, 252, 0.96) 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    transform: rotate(45deg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.header .dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.header .dropdown-item {
    padding: 0.75rem 1.1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1a4377;
    position: relative;
    overflow: hidden;
}

.header .dropdown-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(180deg, #225593, #1a4377);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.header .dropdown-item:hover {
    background: linear-gradient(
        135deg,
        rgba(34, 85, 147, 0.12) 0%,
        rgba(26, 67, 119, 0.08) 100%
    );
    color: #225593;
    transform: translateX(6px);
    box-shadow: 0 2px 8px rgba(26, 67, 119, 0.08);
}

.header .dropdown-item:hover::before {
    transform: translateX(0);
}

.header .dropdown-item i {
    margin-right: 0.5rem;
    color: #225593;
    transition: transform 0.3s ease;
}

.header .dropdown-item:hover i {
    transform: scale(1.1);
}

/* 修正 navbar 用戶圖標與文字的垂直對齊 */
.header .nav-link i.fa-user-circle {
    align-self: center;
    line-height: 1;
    vertical-align: middle;
    transform: translateY(1px); /* 微調向下移動 1px 以達到完美置中 */
}

.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.6rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.12);
}

.navbar-toggler-icon {
    filter: brightness(1.2);
}

@media (max-width: 767.98px) {
    .header {
        padding: 0.6rem 0;
    }
    
    .navbar-brand {
        font-size: 0.9rem;
        padding: 0.6rem 0.6rem;
        margin-left: -5px;
    }
    
    .navbar-brand img {
        width: 32px;
        height: 30px;
    }
    
    .navbar-brand .fs-4 {
        font-size: 1.35rem !important;
    }

    .header .nav-link {
        padding: 0.9rem 1rem;
        border-radius: 8px;
        margin: 0.2rem 0;
    }

    .header .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .navbar-collapse {
        margin-top: 0.8rem;
        background: linear-gradient(
            145deg,
            rgba(26, 67, 119, 0.92) 0%,
            rgba(34, 85, 147, 0.95) 100%
        );
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-radius: 12px;
        padding: 0.8rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.08);
        /* 添加滾動支援 */
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        overflow-x: hidden;
        /* 優化滾動體驗 */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }
    
    /* 自訂滾動條樣式（Webkit 瀏覽器） */
    .navbar-collapse::-webkit-scrollbar {
        width: 6px;
    }
    
    .navbar-collapse::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 10px;
    }
    
    .navbar-collapse::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 10px;
        transition: background 0.3s ease;
    }
    
    .navbar-collapse::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
    
    /* 簡化手機版下拉選單樣式，讓巢狀區塊更清爽 */
    .header .dropdown-menu {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        margin-top: 0.5rem;
        padding: 0.4rem;
    }
    
    /* 移除桌面版的箭頭裝飾 */
    .header .dropdown-menu::before {
        display: none;
    }
    
    .header .dropdown-item {
        color: rgba(255, 255, 255, 0.88);
        padding: 0.7rem 1rem;
        font-size: 0.92rem;
        border-radius: 6px;
    }
    
    .header .dropdown-item:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.12);
        transform: none;
        box-shadow: none;
    }
    
    .header .dropdown-item i {
        color: inherit;
        opacity: 0.9;
    }
    
    /* 簡化 hover 效果的左側條 */
    .header .dropdown-item::before {
        width: 2px;
        background: rgba(255, 255, 255, 0.6);
    }
    
    /* 手機介面下拉選單中的帳號資訊文字樣式 */
    .header .dropdown-item-text {
        color: rgba(255, 255, 255, 0.95);
        padding: 0.7rem 1rem;
    }
    
    .header .dropdown-item-text small.text-muted {
        color: rgba(255, 255, 255, 0.75) !important;
    }
    
    .header .dropdown-item-text strong {
        color: #ffffff !important;
        font-weight: 600;
    }
    
    /* 手機介面登出按鈕的文字顏色 */
    .header .dropdown-item.text-danger {
        color: rgba(255, 255, 255, 0.9) !important;
    }
    
    .header .dropdown-item.text-danger:hover {
        color: #ffffff !important;
        background: rgba(220, 53, 69, 0.2);
    }
    
    .header .dropdown-item.text-danger i {
        color: rgba(255, 200, 200, 0.9) !important;
    }
    
    .header .dropdown-item.text-danger:hover i {
        color: rgba(255, 220, 220, 1) !important;
    }
}

main {
    margin-top: 95px;
    flex: 1; /* 使用弹性布局使内容部分占据剩余的可用高度 */
}

@media (max-width: 767.98px) {
    main {
        margin-top: 85px;
    }
}

.footer {
    position: relative;
    background: linear-gradient(145deg, rgba(28, 31, 38, 0.96) 0%, rgba(17, 19, 24, 0.97) 55%, rgba(10, 11, 15, 0.98) 100%);
    color: rgba(233, 235, 240, 0.92);
    flex-shrink: 0; /* 防止 footer 縮小 */
    overflow: hidden;
    margin-top: 4rem; /* 增加 footer 上方的間距，避免與頁面內容太接近 */
}

.footer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(78, 84, 96, 0.18), rgba(37, 40, 48, 0.06));
    opacity: 0.75;
    pointer-events: none;
}

.footer-inner {
    position: relative;
    z-index: 1;
    max-width: 1200px;
}

.footer-logo-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 16px;
    background: rgba(31, 34, 42, 0.7);
    box-shadow: 0 18px 40px rgba(6, 7, 9, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.footer-logo {
    width: 64px;
    height: auto;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.footer-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.footer-company {
    font-size: 0.95rem;
    color: rgba(202, 206, 214, 0.86);
}

.footer-tagline {
    font-size: 0.9rem;
    color: rgba(205, 210, 220, 0.68);
}

.footer-heading {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: rgba(219, 223, 230, 0.95);
}

.footer-list li {
    margin-bottom: 0.65rem;
    font-size: 0.94rem;
    color: rgba(209, 213, 223, 0.82);
}

.footer-list li:last-child {
    margin-bottom: 0;
}

.footer-list i {
    color: rgba(168, 175, 191, 0.95);
    margin-right: 0.35rem;
}

.footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.footer-social-link {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(48, 52, 61, 0.75);
    color: rgba(214, 218, 226, 0.9);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
    box-shadow: 0 10px 20px rgba(5, 6, 8, 0.35);
}

.footer-social-link i {
    font-size: 1.05rem;
}

.footer-social-link:hover,
.footer-social-link:focus {
    background: rgba(82, 87, 99, 0.9);
    color: rgba(242, 245, 250, 0.95);
    transform: translateY(-2px);
}

.footer a:link,
.footer a:visited {
    color: rgba(178, 185, 200, 0.92);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.footer a:hover,
.footer a:focus {
    color: rgba(214, 220, 232, 0.95);
    opacity: 1;
}

.footer-divider {
    border-color: rgba(117, 123, 136, 0.35);
}

.footer-bottom {
    color: rgba(193, 197, 206, 0.78);
}

.footer-disclaimer {
    font-size: 0.85rem;
    color: rgba(168, 173, 184, 0.65);
}

@media (max-width: 767.98px) {
    .footer {
        margin-top: 3rem; /* 手機上稍微減少間距 */
    }

    .footer-logo {
        width: 56px;
    }

    .footer-inner {
        text-align: center;
    }

    .footer-heading {
        margin-top: 1.25rem;
    }
}

@media (min-width: 768px) {
    .navbar-collapse {
        justify-content: flex-end;
    }

    .footer-social {
        justify-content: flex-start;
    }
}

/* 下拉選單箭頭旋轉效果 */
.dropdown-toggle::after {
    transition: transform 0.2s;
}
.dropdown-toggle.dropdown-opened::after {
    transform: rotate(180deg);
}