/**
 * 敦儀科技網站 - 主要樣式
 */

/* 重置樣式 */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* 確保所有元素沒有意外的邊距 */
section, main, div, nav {
    margin: 0;
    padding: 0;
}

/* 強制消除導航列和 Banner 之間的空白 */
.navbar + .banner-section {
    margin-top: 0 !important; /* 移除負邊距避免重疊問題 */
    padding-top: 70px !important; /* 調整為導航列高度 */
}

/* 手機版特別處理 */
@media (max-width: 767.98px) {
    .navbar + .banner-section {
        padding-top: 70px !important; /* 確保手機版也有正確的間距 */
        margin-top: 0 !important; /* 移除任何可能的邊距 */
    }
    
    .banner-section {
        margin-top: 0 !important; /* 確保 banner-section 沒有上邊距 */
        padding-top: 0 !important; /* 移除 banner-section 的 padding-top */
    }
}

/* 基本設定 */
:root {
    --primary-color: #1e3a8a; /* 深藍色 */
    --secondary-color: #3b82f6; /* 藍色 */
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --font-family: 'Microsoft JhengHei', 'PingFang TC', 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: #333;
    padding-top: 0; /* 移除 body 的 padding-top */
    margin: 0; /* 確保沒有預設邊距 */
}

/* 導航列樣式 */
.navbar {
    margin-bottom: 0; /* 確保導航列沒有下邊距 */
    border-bottom: none; /* 移除可能的邊框 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加陰影增強視覺層次 */
}

.navbar.fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    min-height: 70px; /* 增加導航列最小高度 */
    background-color: var(--primary-color) !important; /* 確保背景色 */
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1.2;
}

.navbar-brand small {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

/* LOGO 樣式 - 強烈對比度 */
.navbar-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.9); /* 強白色背景 */
    border-radius: 8px;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
}

/* Banner 輪播樣式 */
.banner-section {
    position: relative;
    overflow: hidden; /* 改為 hidden 避免內容溢出 */
    margin-top: 0; /* 移除負邊距 */
    padding-top: 0; /* 移除上內距，由 navbar + banner-section 規則處理 */
    margin-bottom: 0; /* 移除負下邊距 */
    padding-bottom: 0; /* 移除下內距 */
    background: transparent; /* 確保背景透明 */
    z-index: 1020; /* 確保輪播圖在導航列下方但在內容上方 */
    width: 100%;
}

.banner-swiper {
    height: 60vh;
    min-height: 400px;
    position: relative;
    z-index: 1020;
    overflow: visible;
    width: 100vw; /* 使用 viewport 寬度 */
    left: 50%;
    right: 50%;
    margin-left: -50vw; /* 負邊距來置中 */
    margin-right: -50vw;
}

.banner-slide {
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1020;
    overflow: visible;
    width: 100%;
    left: 0;
    right: 0;
    margin: 0;
}

.banner-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* 確保輪播圖完全覆蓋 */
.swiper-slide {
    position: relative;
    z-index: 1020;
    height: 100%;
    overflow: visible;
    width: 100% !important; /* 確保 slide 是全寬 */
}

.swiper-wrapper {
    height: 100%;
    overflow: visible;
    width: 100% !important; /* 確保 wrapper 是全寬 */
}

.banner-slide .container {
    position: relative;
    z-index: 2;
}

.swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

.swiper-pagination-bullet-active {
    background: #fff;
}

.swiper-button-next,
.swiper-button-prev {
    color: #fff;
}

/* 主要內容樣式 */
.main-content {
    min-height: calc(100vh - 200px);
    margin-top: 0; /* 確保沒有上邊距 */
    padding-top: 50px; /* 適度的上內距來避免與輪播圖重疊 */
    position: relative;
    z-index: 1; /* 確保在輪播圖下方 */
}

/* 非首頁的頁面增加更多上間距 */
.main-content:not(.homepage) {
    padding-top: 120px !important; /* 增加上間距，使用 !important 確保優先級 */
}

/* 為頁面標題區域增加更多間距 */
.main-content:not(.homepage) .container {
    padding-top: 3rem !important; /* 額外的上間距，使用 !important 確保優先級 */
}

/* 為所有頁面內容增加更多上間距 */
.main-content.page-content {
    padding-top: 80px !important; /* 適度的上間距避免與導航列重疊 */
}

.main-content.page-content .container {
    padding-top: 1.5rem !important; /* 適度的容器上間距 */
}

/* 產品詳情頁面特殊處理 - 麵包屑導航間距 */
.main-content.page-content nav[aria-label="breadcrumb"] {
    margin-top: 1rem !important; /* 適度的麵包屑容器上邊距 */
    margin-bottom: 1rem !important; /* 適度的下邊距 */
}

.main-content.page-content .breadcrumb {
    margin-top: 0 !important; /* 重置麵包屑本身的上邊距 */
    margin-bottom: 1rem !important; /* 設定下邊距 */
    padding: 1rem 0 !important; /* 增加內邊距 */
}

.main-content .container {
    margin-top: 0; /* 確保容器沒有上邊距 */
}

.content-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
}

/* 卡片樣式 */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* 側邊欄樣式 */
.sidebar .card {
    margin-bottom: 1.5rem;
}

.sidebar .list-unstyled li {
    border-bottom: 1px solid #f0f0f0;
    padding: 0.5rem 0;
}

.sidebar .list-unstyled li:last-child {
    border-bottom: none;
}

.sidebar .list-unstyled a {
    color: #333;
    transition: color 0.3s ease;
}

.sidebar .list-unstyled a:hover {
    color: var(--primary-color);
}

/* 按鈕樣式 */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #1e40af;
    border-color: #1e40af;
    transform: translateY(-2px);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 產品展示樣式 */
.product-card {
    height: 100%;
}

.product-card .card-body {
    display: flex;
    flex-direction: column;
}

.product-card .list-unstyled li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

/* 首頁產品標題樣式 */
.homepage .card-header h5 {
    font-size: 1.1rem;
    line-height: 1.4;
    word-break: break-word;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

/* 確保產品卡片有足夠寬度 */
.homepage .col-lg-6 {
    min-width: 0;
}

/* 產品卡片內容區域 */
.homepage .card-header {
    min-height: auto;
    padding: 1rem;
}

/* 頁腳樣式 */
footer {
    margin-top: auto;
}

footer h5 {
    color: #ffffff !important;
    font-weight: 600;
    margin-bottom: 1rem;
}

footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #ffffff;
}

/* 合作夥伴區塊樣式 */
.partner-card {
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.partner-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.partner-logo {
    max-width: 120px;
    height: auto;
}

.partner-logo-container {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ASSI Logo 佔位樣式 */
.assi-logo-placeholder .logo-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo-assi {
    font-size: 2.5rem;
    font-weight: bold;
    color: #0066cc;
    font-style: italic;
}

.logo-icon {
    font-size: 2rem;
    color: #ffcc00;
    text-shadow: 1px 1px 2px rgba(255, 0, 0, 0.3);
}

.partner-card .btn {
    min-width: 140px;
}

/* 響應式設計 */
@media (max-width: 991.98px) {
    .banner-swiper {
        height: 50vh;
        min-height: 400px;
    }
    
    .banner-slide h1 {
        font-size: 2rem;
    }
    
    .banner-slide .lead {
        font-size: 1rem;
    }
}

@media (max-width: 767.98px) {
    body {
        padding-top: 0; /* 移除 body 的 padding-top，由 banner 處理間距 */
    }
    
    .banner-swiper {
        height: 40vh;
        min-height: 300px;
    }
    
    .banner-slide h1 {
        font-size: 1.5rem;
    }
    
    .banner-slide .lead {
        font-size: 0.9rem;
    }
    
    .main-content .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .sidebar {
        margin-bottom: 2rem;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-brand small {
        font-size: 0.8rem;
        display: none; /* 手機版隱藏英文名稱以節省空間 */
    }
    
    .navbar-logo {
        height: 30px; /* 手機版縮小 LOGO */
        padding: 3px 6px; /* 手機版較小內距 */
    }
    
    .banner-slide h1 {
        font-size: 1.25rem;
    }
    
    .banner-slide .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* 動畫效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 表單樣式 */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(255, 102, 0, 0.25);
}

.form-label {
    font-weight: 500;
    color: #333;
}

/* 警告訊息樣式 */
.alert {
    border-radius: 0.375rem;
    border: none;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* 工具提示樣式 */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: var(--dark-color);
    border-radius: 0.25rem;
}

/* 分頁樣式 */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #dee2e6;
}

.pagination .page-link:hover {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 圖片樣式 */
.img-fluid {
    border-radius: 0.375rem;
}

.img-thumbnail {
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
}

/* 文字樣式 */
.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

/* 背景樣式 */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

/* 自定義滾動條 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1; /* 改為一般灰色 */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8; /* hover 時稍微深一點的灰色 */
}

/* 列印樣式 */
@media print {
    .navbar,
    .banner-section,
    footer,
    .btn {
        display: none !important;
    }
    
    body {
        padding-top: 0;
    }
    
    .main-content {
        min-height: auto;
    }
}
