@charset "UTF-8";

/* 基本樣式 */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #e2e8f0;
    --text-color: #2d3748;
    --text-muted: #6c757d;
    --shadow-light: 0 10px 20px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 20px 40px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 25px 50px rgba(0, 0, 0, 0.15);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-hover: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --border-radius: 12px;
    --border-radius-large: 20px;
    --transition: all 0.3s ease;
}

/* 全域樣式 */
body {
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
}

/* 卡片樣式 */
.main-card {
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-heavy);
    border: none;
    overflow: hidden;
    background: white;
    width: 100%; /* 使用完整寬度 */
}

/* 頁首樣式 */
.page-header {
    background: var(--gradient-primary);
    color: white;
    position: relative;
    padding: 2rem; /* 預設內距 */
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="3" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="80" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
}

.page-header .content {
    position: relative;
    z-index: 1;
}

.page-header .actions {
    position: relative;
    z-index: 2;
}

/* 按鈕樣式 */
.btn-primary-custom {
    background: var(--primary-color);
    border: none;
    color: white;
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.btn-primary-custom:hover {
    background: var(--gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-primary-custom:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* 表單樣式 */
.form-control-custom {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    transition: var(--transition);
}

.form-control-custom:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}

.form-label-custom {
    font-weight: 500;
    color: var(--text-color);
}

/* 連結樣式 */
.link-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: var(--transition);
}

.link-gradient:hover {
    text-decoration: underline !important;
}

/* 導航欄樣式 */
.navbar-custom {
    background: var(--gradient-primary);
    box-shadow: var(--shadow-light);
}

.navbar-custom .navbar-brand {
    color: white !important;
    font-weight: 600;
}

.navbar-custom .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    transition: var(--transition);
}

.navbar-custom .nav-link:hover {
    color: white !important;
}

/* 警告訊息樣式 */
.alert-custom {
    border-radius: var(--border-radius);
    border: none;
    font-weight: 500;
}

/* 表格樣式 */
.table-custom {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.table-custom th {
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-weight: 500;
}

.table-custom td {
    border-color: var(--border-color);
}

/* 主要內容區域樣式 */
.content-section {
    width: 100%;
}

/* 主要內容區域 */
.main-content {
    transition: all 0.3s ease;
}

/* 儀表板統計卡片樣式 */
.dashboard-stats .card {
    transition: var(--transition);
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-light);
}

.dashboard-stats .card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.dashboard-stats .card .card-body {
    padding: 1.5rem;
}

.dashboard-stats .card h5 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.dashboard-stats .card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0;
}

/* 響應式樣式 */

/* 手機版樣式 (xs: < 576px) */
@media (max-width: 575.98px) {
    :root {
        font-size: 14px;
    }
    
    .main-card {
        margin: 1rem 0;
        border-radius: 15px;
    }
    
    .page-header {
        padding: 1.5rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .form-control-custom {
        padding: 10px 14px;
    }
    
    .btn-primary-custom {
        padding: 12px;
        font-size: 1rem;
    }
    
    .navbar-custom .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* 手機版側邊欄樣式調整 */
    .list-group-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .list-group-item i {
        width: 1.2rem;
    }
    
    /* 手機版儀表板統計卡片 */
    .dashboard-stats .card h3 {
        font-size: 1.5rem;
    }
    
    .dashboard-stats .card .card-body {
        padding: 1rem;
    }
}

/* 小手機版樣式 (xxs: < 400px) */
@media (max-width: 399.98px) {
    :root {
        font-size: 13px;
    }
    
    .main-card {
        margin: 0.5rem 0;
        border-radius: 10px;
    }
    
    .page-header {
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-primary-custom {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .dashboard-stats .card h3 {
        font-size: 1.25rem;
    }
}

/* 平板版樣式 (sm: 576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    :root {
        font-size: 15px;
    }
    
    .page-header {
        padding: 2rem;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    .dashboard-stats .card h3 {
        font-size: 1.75rem;
    }
}

/* 大平板版樣式 (md: 768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .page-header {
        padding: 2.5rem;
    }
    
    .card-body {
        padding: 2.5rem;
    }
    
    .col-md-9 {
        flex: 0 0 auto;
        width: 75%; /* 12列中的9列 */
    }
    
    .col-md-3 {
        flex: 0 0 auto;
        width: 25%; /* 12列中的3列 */
    }
}

/* 桌面版樣式 (lg: 992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .page-header {
        padding: 2.5rem;
    }
    
    .card-body {
        padding: 2.5rem;
    }
    
    .col-lg-10 {
        flex: 0 0 auto;
        width: 83.33333333%; /* 12列中的10列 */
    }
    
    .col-lg-2 {
        flex: 0 0 auto;
        width: 16.66666667%; /* 12列中的2列 */
    }
}

/* 大桌面版樣式 (xl: 1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .page-header {
        padding: 3rem;
    }
    
    .card-body {
        padding: 3rem;
    }
}

/* 超大桌面版樣式 (xxl: ≥ 1400px) */
@media (min-width: 1400px) {
    .page-header {
        padding: 3rem;
    }
    
    .card-body {
        padding: 3rem;
    }
}

/* 手機版本 - 側邊欄在上方 */
@media (max-width: 767.98px) {
    .col-12 {
        width: 100%;
    }
}

/* 表格響應式優化 */
@media (max-width: 767.98px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* 觸控設備優化 */
@media (hover: none) and (pointer: coarse) {
    .btn-primary-custom:hover {
        transform: none;
        box-shadow: none;
    }
    
    .form-control-custom:focus {
        transform: none;
    }
    
    .dashboard-stats .card:hover {
        transform: none;
    }
}

/* 高對比度模式 */
@media (prefers-contrast: high) {
    .form-control-custom {
        border-width: 3px;
    }
    
    .btn-primary-custom {
        border: 2px solid #000;
    }
}

/* 減少動畫模式 */
@media (prefers-reduced-motion: reduce) {
    .btn-primary-custom,
    .form-control-custom,
    .dashboard-stats .card {
        transition: none;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .form-label-custom {
        color: var(--text-color);
    }
}

/* 工具類別 */
.bg-gradient-primary {
    background: var(--gradient-primary);
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: var(--shadow-medium);
}

.border-radius-custom {
    border-radius: var(--border-radius);
}

.border-radius-large {
    border-radius: var(--border-radius-large);
}

/* 動畫效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 載入動畫 */
.spinner-custom {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 側邊欄樣式 */
.sidebar-card {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: none;
    overflow: hidden;
    background: white;
}

.sidebar-card .card-header {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem;
}

.sidebar-card .list-group-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.sidebar-card .list-group-item:hover {
    background-color: var(--light-color);
    transform: translateX(5px);
}

.sidebar-card .list-group-item.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.sidebar-card .list-group-item.active:hover {
    background: var(--gradient-hover);
    transform: translateX(5px);
}

/* 模態框樣式 */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-heavy);
}

.modal-header {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* 表格樣式改進 */
.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.table .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* 按鈕群組樣式 */
.btn-group-sm .btn {
    transition: var(--transition);
}

.btn-group-sm .btn:hover {
    transform: translateY(-1px);
}

/* 特殊元件 */
.login-card {
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-heavy);
    border: none;
    overflow: hidden;
    background: white;
    width: 100%;
}

.login-header {
    background: var(--gradient-primary);
    color: white;
    position: relative;
    padding: 2rem;
}

/* 標題頂部間距 */
.login-header h1 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.btn-login {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

/* 頁腳樣式 */
.footer-custom {
    background: var(--gradient-primary);
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

/* 搜尋框樣式 */
.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* 分頁樣式 */
.pagination .page-link {
    color: var(--primary-color);
    border-color: var(--border-color);
}

.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.page-item.active a{
    color: #FFF;
}

/* 麵包屑樣式 */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: var(--text-muted);
}

/* 統計數字動畫 */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-stats .card h3 {
    animation: countUp 0.8s ease-out;
}

/* 響應式圖表容器 */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

@media (max-width: 767.98px) {
    .chart-container {
        height: 250px;
    }
}

/* 狀態指示器 */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-indicator.online {
    background-color: var(--success-color);
}

.status-indicator.offline {
    background-color: var(--danger-color);
}

.status-indicator.busy {
    background-color: var(--warning-color);
}

/* 進度條樣式 */
.progress-custom {
    height: 0.5rem;
    border-radius: var(--border-radius);
    background-color: var(--border-color);
}

.progress-custom .progress-bar {
    background: var(--gradient-primary);
    border-radius: var(--border-radius);
}

/* 工具提示樣式 */
.tooltip-custom {
    position: relative;
    cursor: help;
}

.tooltip-custom::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip-custom:hover::after {
    opacity: 1;
}

/* 空狀態樣式 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 載入骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin: 0.5rem 0;
    border-radius: 4px;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

/* 打印樣式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .page-header {
        background: white !important;
        color: black !important;
    }
    
    .main-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* 側邊欄樣式 */
.sidebar {
    padding: 0;
}

.sidebar .card {
    border-radius: 0;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar .list-group-item {
    border: none;
    padding: 12px 20px;
    transition: all 0.3s ease;
}

.sidebar .list-group-item:hover {
    background-color: #f8f9fa;
}

.sidebar .list-group-item.active {
    background-color: #007bff;
    color: white;
}

.sidebar .list-group-item i {
    width: 20px;
    text-align: center;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .sidebar {
        margin-bottom: 20px;
    }

    .navbar-toggler {
        display: none;
    }
    
    /* 手機版主要內容區域調整 */
    .main-content,
    .col-12.col-md-9.col-lg-10 {
        padding-left: 15px;
        padding-right: 15px;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    /* 手機版頁首調整 */
    .page-header {
        padding: 1.5rem 1rem;
    }
    
    /* 手機版卡片間距調整 */
    .main-card {
        margin-bottom: 1rem;
    }
    
    /* 手機版表格響應式 */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* 手機版按鈕組調整 */
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Offcanvas 樣式調整 */
.offcanvas .list-group-item {
    border: none;
    padding: 12px 20px;
    transition: all 0.3s ease;
}

.offcanvas .list-group-item:hover {
    background-color: #f8f9fa;
}

.offcanvas .list-group-item.active {
    background-color: #007bff;
    color: white;
}

.offcanvas .list-group-item i {
    width: 20px;
    text-align: center;
}

/* 手機版 Navbar 調整 */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand i {
        display: none;
    }
}

/* 超小螢幕優化 */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .page-header {
        padding: 1rem 0.75rem;
    }
    
    .page-header h2 {
        font-size: 1.1rem !important;
        line-height: 1.3;
    }
    
    .page-header p {
        font-size: 0.85rem;
        margin-bottom: 0;
    }
    
    /* 搜索輸入框在小螢幕上的優化 */
    .row.mb-3 .col-md-2,
    .row.mb-3 .col-md-1 {
        margin-bottom: 0.5rem;
    }
    
    /* 表格在超小螢幕的優化 */
    .table-responsive table {
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 0.25rem;
        white-space: nowrap;
    }
    
    /* 模態框在手機版的優化 */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-dialog.modal-lg {
        max-width: calc(100vw - 1rem);
    }
    
    /* 分頁按鈕在手機版的優化 */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* 主要內容區域 */
.main-content {
    transition: all 0.3s ease;
}

/* 手機版主要內容區域全寬 */
@media (max-width: 768px) {
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}