/* 全域樣式 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Header 樣式 */
header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

header h1 {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Card 樣式 */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

/* 表格樣式 */
.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.table th {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 12px 8px;
    border: none;
    white-space: nowrap;
    min-width: 120px;
}

.table td {
    padding: 10px 8px;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 123, 255, 0.02);
}

/* 表格欄位對齊 */
.table th:nth-child(1), .table td:nth-child(1) { /* TTS P/N */
    text-align: center;
    font-weight: 600;
    color: #007bff;
}

.table th:nth-child(2), .table td:nth-child(2) { /* 品牌 */
    text-align: center;
    font-weight: 500;
}

.table th:nth-child(3), .table td:nth-child(3) { /* 車型 */
    text-align: left;
    max-width: 200px;
    word-wrap: break-word;
}

.table th:nth-child(4), .table td:nth-child(4) { /* 年份 */
    text-align: center;
}

.table th:nth-child(5), .table td:nth-child(5) { /* 前 */
    text-align: center;
    width: 60px;
}

.table th:nth-child(6), .table td:nth-child(6) { /* 後 */
    text-align: center;
    width: 60px;
}

.table th:nth-child(7), .table td:nth-child(7) { /* 備註 */
    text-align: left;
    max-width: 150px;
    word-wrap: break-word;
}

.table th:nth-child(8), .table td:nth-child(8) { /* 圖樣 */
    text-align: center;
    width: 80px;
}

/* TTS料號連結樣式 */
.tts-link {
    cursor: pointer;
    color: #007bff !important;
    text-decoration: underline;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.tts-link:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: #0056b3 !important;
    text-decoration: none;
    transform: scale(1.05);
}

.tts-link:active {
    transform: scale(0.95);
}

/* 前後輪位置樣式 */
.text-success.fw-bold {
    font-size: 1.2rem;
    color: #28a745 !important;
}

/* 搜尋高亮 */
.highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* 按鈕樣式 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
}

.btn-outline-primary {
    border-color: #007bff;
    color: #007bff;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-color: #007bff;
}

/* 表單樣式 */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.input-group-text {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #e9ecef;
    border-right: none;
}

/* 分頁樣式 */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    color: #007bff;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    transform: translateY(-1px);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-color: #007bff;
}

.page-item.disabled .page-link {
    color: #6c757d;
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* 徽章樣式 */
.badge {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

/* 載入動畫 */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 圖片Modal樣式 */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    color: #495057;
    font-weight: 600;
}

.modal-body {
    padding: 2rem;
}

#productImage {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

#productImage:hover {
    transform: scale(1.02);
}

.modal-footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 12px 12px;
}

/* 圖片載入狀態樣式 */
#imageLoading, #imageError, #noImage {
    padding: 3rem 1rem;
}

#imageLoading .spinner-border {
    width: 3rem;
    height: 3rem;
}

#imageError i, #noImage i {
    color: #6c757d;
    margin-bottom: 1rem;
}

#imageError h5, #noImage h5 {
    color: #6c757d;
    margin-bottom: 0.5rem;
}

#imageError p, #noImage p {
    color: #6c757d;
    font-size: 0.9rem;
}

/* 響應式表格 */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    .table th, .table td {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
    
    .table th:nth-child(3), .table td:nth-child(3) { /* 車型 */
        max-width: 120px;
    }
    
    .table th:nth-child(7), .table td:nth-child(7) { /* 備註 */
        max-width: 100px;
    }
    
    /* 響應式Modal */
    .modal-dialog {
        margin: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    #productImage {
        max-height: 300px;
    }
}

/* 無資料訊息樣式 */
.text-muted {
    color: #6c757d !important;
}

/* Footer 樣式 */
footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
}

/* 固定表頭（Sticky Table Header） */
.table-responsive {
    max-height: 65vh; /* 限制高度以便內容滾動 */
    overflow: auto;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 3; /* 確保覆蓋資料列 */
}

/* 系統資訊區域 */
.info-content h5 {
    color: #28a745;
    font-weight: 600;
}

.upload-info h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* 結果計數徽章 */
#resultCount {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

/* 語言切換按鈕樣式 */
.language-switcher .btn-group .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.language-switcher .btn-group .btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.language-switcher .btn-group .btn.active {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
}

/* 響應式語言切換 */
@media (max-width: 768px) {
    .language-switcher .btn-group .btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
} 