/**
 * IT請修通報系統 - 主要樣式文件
 * 
 * @author IT Department
 * @version 1.0
 */

/* 全域樣式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    line-height: 1.6;
}

/* 導航欄樣式 */
.navbar-brand {
    font-weight: bold;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
}

/* 卡片樣式 */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* 狀態徽章樣式 */
.status-processing {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.status-coordinating {
    background-color: #17a2b8 !important;
    color: white !important;
}

.status-completed {
    background-color: #28a745 !important;
    color: white !important;
}

.status-cancelled {
    background-color: #6c757d !important;
    color: white !important;
}

.status-unknown {
    background-color: #e9ecef !important;
    color: #495057 !important;
}

/* 表格樣式 */
.table {
    background-color: #fff;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* 排序樣式 */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: #e9ecef !important;
}

.sort-icon {
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: 5px;
    transition: color 0.2s ease;
    opacity: 0.6;
}

.sortable:hover .sort-icon {
    opacity: 1;
    color: #495057;
}

.sortable.sort-asc .sort-icon::before {
    content: "\f52d"; /* bi-chevron-up */
    color: #0d6efd;
    opacity: 1;
}

.sortable.sort-desc .sort-icon::before {
    content: "\f52e"; /* bi-chevron-down */
    color: #0d6efd;
    opacity: 1;
}

.sortable:not(.sort-asc):not(.sort-desc) .sort-icon::before {
    content: "\f145"; /* bi-chevron-expand */
}

.sortable.sort-asc .sort-icon,
.sortable.sort-desc .sort-icon {
    color: #0d6efd;
    opacity: 1;
}

/* 按鈕樣式 */
.btn {
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-xs {
    padding: 0.125rem 0.25rem;
    font-size: 0.75rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

/* 表單樣式 */
.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.is-invalid {
    border-color: #dc3545;
}

.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* 警告框樣式 */
.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert-success {
    background-color: #d1edff;
    color: #0c5460;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* 統計卡片樣式 */
.card.bg-primary,
.card.bg-warning,
.card.bg-info,
.card.bg-success {
    border: none;
}

/* 可點擊卡片懸停效果 */
.card-hover {
    transition: all 0.3s ease;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.2);
}

/* 確保連結文字顏色保持白色 */
a .card-hover.text-white,
a .card-hover.text-white * {
    color: white !important;
}

a .card-hover.text-white:hover,
a .card-hover.text-white:hover * {
    color: white !important;
    transition: transform 0.2s ease;
}

.card.bg-primary:hover,
.card.bg-warning:hover,
.card.bg-info:hover,
.card.bg-success:hover {
    transform: translateY(-2px);
}

/* 分頁樣式 */
.pagination .page-link {
    color: #007bff;
    border-color: #dee2e6;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #007bff;
}

.pagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
    color: #ffffff !important;
}

.pagination .page-item.active .page-link:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    color: #ffffff !important;
}

/* 載入動畫 */
.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);
    }
}

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

/* 檔案上傳區域 */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.05);
}

.file-upload-area.dragover {
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.05);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group-vertical .btn {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .card-header h5,
    .card-header h6 {
        font-size: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .badge {
        font-size: 0.75rem;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e9ecef;
    }
    
    .card {
        background-color: #2d3748;
        color: #e9ecef;
    }
    
    .table {
        background-color: #2d3748;
        color: #e9ecef;
    }
    
    .table th {
        background-color: #4a5568;
        color: #e9ecef;
    }
    
    .form-control,
    .form-select {
        background-color: #4a5568;
        border-color: #718096;
        color: #e9ecef;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #4a5568;
        border-color: #80bdff;
        color: #e9ecef;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 動畫效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 特殊效果 */
.glow {
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* 列印樣式 */
@media print {
    .navbar,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    body {
        background-color: #fff !important;
        color: #000 !important;
    }
}

/* 輔助類別 */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-left-primary {
    border-left: 4px solid #007bff !important;
}

.border-left-success {
    border-left: 4px solid #28a745 !important;
}

.border-left-warning {
    border-left: 4px solid #ffc107 !important;
}

.border-left-danger {
    border-left: 4px solid #dc3545 !important;
}

.bg-gradient-primary {
    background: linear-gradient(45deg, #007bff, #0056b3) !important;
}

.bg-gradient-success {
    background: linear-gradient(45deg, #28a745, #1e7e34) !important;
}

.bg-gradient-warning {
    background: linear-gradient(45deg, #ffc107, #e0a800) !important;
}

.bg-gradient-danger {
    background: linear-gradient(45deg, #dc3545, #c82333) !important;
}