/* ============================================
   全站頁尾安全樣式（避免缺 CSS 時白底白字）
   ============================================ */
footer {
    background-color: #1a252f;
    color: #ecf0f1;
}
footer h4 {
    color: #fff;
}
footer a {
    color: #bdc3c7;
    text-decoration: none;
}
footer a:hover {
    color: #fff;
}
footer .text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}
footer .contact-list a {
    color: inherit;
}

/* 產品頁實績：精簡縮圖列 */
.case-thumb-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 0;
    margin: 0;
    list-style: none;
    align-items: start;
}
.case-thumb-strip:has(> :nth-child(4)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.case-thumb-panel {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px 16px 18px;
    margin-bottom: 24px;
    box-shadow: 0 4px 14px rgba(15, 44, 71, 0.05);
}
.case-thumb-panel .case-thumb-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #0F2C47;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef2f6;
}
.case-thumb-panel .case-thumb-heading i {
    color: #C0392B;
}
.case-thumb-item {
    display: block;
    min-width: 0;
    width: 100%;
    max-width: none;
    text-decoration: none !important;
    color: #333;
    transition: transform 0.25s, color 0.25s;
}
.case-thumb-item:hover {
    transform: translateY(-3px);
    color: #0F2C47;
}
.case-thumb-item .case-thumb-img {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    height: auto;
    padding-bottom: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f1f1;
    border: 1px solid #eee;
}
.case-thumb-item .case-thumb-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s;
}
.case-thumb-item:hover .case-thumb-img img {
    transform: scale(1.05);
}
.case-thumb-item .case-thumb-img::after {
    content: '看案例';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(transparent, rgba(15, 44, 71, 0.85));
}
.case-thumb-item .case-thumb-label {
    display: block;
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: 700;
    color: #0F2C47;
}
.case-thumb-item .case-thumb-sub {
    display: block;
    font-size: 0.8rem;
    color: #777;
    font-weight: 400;
    margin-top: 2px;
}
.case-thumb-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0F2C47;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    padding: 12px;
    line-height: 1.45;
}
.case-thumb-item .case-thumb-img.no-cta::after {
    content: none;
}
@media (max-width: 991.98px) {
    .case-thumb-strip,
    .case-thumb-strip:has(> :nth-child(4)) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 767.98px) {
    .case-thumb-item .case-thumb-label {
        font-size: 0.82rem;
    }
    .case-thumb-item .case-thumb-sub {
        font-size: 0.72rem;
    }
    .case-thumb-panel {
        padding: 14px;
    }
}

/* 頁尾社群圖標：強制正圓，避免 LINE／IG 等品牌圖被撐變形 */
footer .social-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    padding: 0 !important;
    margin-right: 8px;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    box-sizing: border-box !important;
    overflow: hidden;
    line-height: 1 !important;
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 1.15rem;
    vertical-align: middle;
}
footer .social-link:hover {
    color: #fff !important;
    background: #C0392B;
    transform: translateY(-2px);
}
footer .social-link i,
footer .social-link .fa-brands,
footer .social-link .fab,
footer .social-link svg {
    display: inline-block !important;
    line-height: 1 !important;
    width: auto !important;
    height: 1.15rem !important;
    max-width: 1.35rem !important;
    max-height: 1.15rem !important;
    font-size: 1.15rem !important;
    flex-shrink: 0;
    vertical-align: middle;
}

/* 頁尾聯絡列圖標：固定方形比例，避免 fa-fw 被拉長 */
footer .contact-list li {
    display: flex;
    align-items: center;
}
footer .contact-list i {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 1.25em !important;
    height: 1.25em !important;
    min-width: 1.25em !important;
    max-width: 1.25em !important;
    line-height: 1 !important;
    flex-shrink: 0;
    text-align: center;
    font-size: 1em !important;
}

/* 浮動聯絡按鈕（桌面；手機版於下方 media 隱藏） */
.floating-contact {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 15px;
    align-items: flex-end;
}
.float-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    transition: 0.3s;
}
.float-btn:hover {
    transform: scale(1.1);
    color: #fff !important;
}
.float-btn.btn-line { background: #06c755; }
.float-btn.btn-phone { background: #C0392B; }
.float-btn.btn-fb { background: #1877f2; }
.float-btn.btn-ig {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

/* ============================================
   手機版手風琴導覽選單（所有頁面共用）
   ============================================ */

/* lg 以上隱藏手風琴，顯示桌機版 */
@media (min-width: 992px) {
    .mobile-accordion-menu { display: none !important; }
}

/* lg 以下：手風琴選單樣式 */
@media (max-width: 991px) {
    #navbarContent {
        max-height: calc(100vh - 130px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-accordion-menu { display: block; }
    .desktop-dropdown-menu { display: none !important; }

    .mob-acc-item { border-bottom: 1px solid #f0f0f0; }

    .mob-acc-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: none;
        border: none;
        padding: 12px 16px;
        font-size: 1rem;
        font-weight: 600;
        color: #444;
        text-align: left;
        cursor: pointer;
        text-decoration: none;
    }
    .mob-acc-btn:hover { color: #C0392B; background: #fafafa; }

    .mob-acc-btn .mob-acc-arrow {
        font-size: 0.75rem;
        color: #aaa;
        transition: transform 0.25s ease;
        flex-shrink: 0;
        margin-left: 8px;
    }
    .mob-acc-btn[aria-expanded="true"] .mob-acc-arrow {
        transform: rotate(180deg);
        color: #C0392B;
    }
    .mob-acc-btn[aria-expanded="true"] { color: #C0392B; }

    .mob-acc-body { background: #f8f9fa; }

    .mob-acc-group-label {
        font-size: 0.75rem;
        font-weight: 700;
        color: #0F2C47;
        padding: 8px 20px 4px;
        letter-spacing: 1px;
        text-transform: uppercase;
        background: #eef4ff;
        display: block;
    }

    .mob-acc-link {
        display: flex;
        align-items: center;
        padding: 10px 20px;
        font-size: 0.93rem;
        color: #555;
        text-decoration: none;
        border-left: 3px solid transparent;
        transition: 0.2s;
    }
    .mob-acc-link:hover {
        color: #C0392B;
        border-left-color: #C0392B;
        background: #fff;
    }

    .mob-acc-divider { height: 1px; background: #e8e8e8; margin: 4px 16px; }

    #mobPort,
    #mobProd {
        max-height: 68vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #mobPort { overscroll-behavior: contain; }
    #mobProd { overscroll-behavior: contain; }

    .mob-acc-nested { margin: 0; }
    .mob-acc-nested-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: #eef4ff;
        border: none;
        padding: 8px 20px 8px;
        font-size: 0.75rem;
        font-weight: 700;
        color: #0F2C47;
        text-align: left;
        cursor: pointer;
        letter-spacing: 1px;
        text-transform: uppercase;
    }
    .mob-acc-nested-btn:hover { background: #e0ebff; color: #C0392B; }
    .mob-acc-nested-btn .mob-acc-group-label { padding: 0; background: none; display: inline; }
    .mob-acc-nested-arrow {
        font-size: 0.65rem;
        color: #888;
        transition: transform 0.25s ease;
        flex-shrink: 0;
        margin-left: 8px;
    }
    .mob-acc-nested-btn[aria-expanded="true"] .mob-acc-nested-arrow {
        transform: rotate(180deg);
        color: #C0392B;
    }
    .mob-acc-nested-body { padding: 0 0 8px; background: #f0f4fa; }

    .mob-plain-link {
        display: block;
        padding: 12px 16px;
        font-size: 1rem;
        font-weight: 600;
        color: #444;
        text-decoration: none;
        border-bottom: 1px solid #f0f0f0;
    }
    .mob-plain-link:hover { color: #C0392B; background: #fafafa; }
    .mob-plain-link.active { color: #C0392B; }

    .mob-cta-wrap { padding: 14px 16px; }
}

/* ============================================
   手機版底部固定導覽列（所有頁面共用）
   ============================================ */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background: #fff;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 9999;
        justify-content: space-around;
        align-items: center;
        padding-bottom: 5px;
    }
    .mobile-nav-item {
        flex: 1;
        text-align: center;
        text-decoration: none;
        color: #555;
        font-size: 0.75rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
    .mobile-nav-item i { font-size: 1.4rem; margin-bottom: 2px; }
    .mobile-nav-item.call { color: #C0392B; }
    .mobile-nav-item.line { color: #06c755; }
    .mobile-nav-item.fb { color: #1877F2; }
}

/* ============================================
   無障礙：跳到主要內容連結（鍵盤 Tab 聚焦時顯示）
   ============================================ */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 12px 20px;
    background: var(--primary-color, #0F2C47);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    transition: left 0.2s;
}
.skip-link:focus {
    left: 0;
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* ============================================
   浮動聯絡按鈕（桌機版顯示，手機版由 mobile-bottom-nav 取代）
   ============================================ */
@media (min-width: 769px) {
    .floating-contact {
        position: fixed;
        bottom: 30px;
        right: 30px;
        z-index: 9999;
        display: flex;
        flex-direction: column-reverse;
        gap: 15px;
        align-items: flex-end;
    }
    .float-btn {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white !important;
        font-size: 20px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        text-decoration: none;
        transition: 0.3s;
    }
    .float-btn:hover { transform: scale(1.1); color: white !important; }
    .float-btn.btn-line { background: #06c755; }
    .float-btn.btn-phone { background: var(--accent-color, #C0392B); }
    .float-btn.btn-fb { background: #1877f2; }
    .float-btn.btn-ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
}

/* ============================================
   手機版修復：恢復左側圖示、統一頂部尺寸
   ============================================ */

@media (max-width: 768px) {
    .top-bar {
        display: block !important;
        padding: 12px 0;
        font-size: 0.8rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .top-bar .container {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        padding: 0 15px !important;
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .top-bar .d-none.d-md-block {
        display: none !important;
    }

    .top-bar-mobile-left {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        padding-right: 10px;
        border-right: 1px solid rgba(255,255,255,0.35);
        min-width: 0;
        overflow: hidden;
    }

    .top-bar-mobile-left span {
        white-space: nowrap;
        line-height: 1.4;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-bar-mobile-left i {
        margin-right: 6px;
        opacity: 0.95;
        width: 14px;
        text-align: center;
    }

    .top-bar .container > div:last-child {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        gap: 8px;
        padding-left: 12px;
        min-width: 0;
        overflow: hidden;
    }

    .top-bar a {
        margin-right: 0;
        font-size: 0.85rem;
        padding: 2px 0;
        white-space: nowrap;
        line-height: 1.4;
    }
}

@media (max-width: 400px) {
    .top-bar .container {
        grid-template-columns: 1fr !important;
    }

    .top-bar-mobile-left {
        border-right: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.35);
        padding-right: 0 !important;
        padding-bottom: 10px;
    }

    .top-bar .container > div:last-child {
        padding-left: 0 !important;
        padding-top: 8px;
    }
}

@media (max-width: 768px) {
    .side-sticky-btn-group {
        display: flex !important;
        padding: 8px 4px;
    }

    .side-sticky-btn {
        padding: 8px 4px;
        font-size: 0.75rem;
        writing-mode: vertical-rl;
    }

    .navbar {
        padding: 8px 0 !important;
        min-height: 56px;
    }

    .navbar-brand img {
        height: 45px !important;
        width: auto !important;
    }

    .page-header,
    .about-header,
    .news-header {
        padding: 50px 15px 40px !important;
        min-height: 120px !important;
    }

    .page-header h1,
    .about-header h1,
    .news-header h1 {
        font-size: 1.5rem !important;
    }

    .floating-contact {
        display: none !important;
    }

    .navbar-nav .nav-link,
    .navbar-nav .dropdown-toggle,
    .btn,
    .side-sticky-btn {
        min-height: 44px !important;
        min-width: 44px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        padding: 10px 16px !important;
    }
    .navbar-toggler {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 12px !important;
    }
}
