:root {
    --sidebar-width: 260px;
    --primary-color: #4e73df;
    --dark-bg: #343a40;
}

body, html {
    height: 100%;
    margin: 0;
    background-color: #f8f9fc;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 側邊欄固定 */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--dark-bg);
    color: #fff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-brand {
    padding: 20px;
    font-size: 1.25rem;
    font-weight: bold;
    background: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.sidebar-nav li a {
    padding: 15px 25px;
    display: block;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: 0.3s;
}

    .sidebar-nav li.active a, .sidebar-nav li a:hover {
        color: #fff;
        background: rgba(255,255,255,0.1);
        border-left: 4px solid var(--primary-color);
    }

.sidebar-nav i {
    width: 25px;
    margin-right: 10px;
}

/* 主要內容區位移 */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width); /* 重要：預留空間給側邊欄 */
    display: flex;
    flex-direction: column;
}

.admin-footer {
    margin-top: auto;
    padding: 20px;
    background: #fff;
    border-top: 1px solid #e3e6f0;
    text-align: center;
    color: #858796;
}

/* 卡片與表單美化 */
.card {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 20px;
}

.form-group label {
    font-weight: 600;
    color: #4e73df;
    margin-bottom: 8px;
}

textarea.form-control {
    border-radius: 8px;
    border: 1px solid #d1d3e2;
}

/* 修正截圖中按鈕與連結擠在一起的問題 */
.form-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}


/* 修改背景色與字體 */
body {
    background-color: #f8f9fc !important;
}

/* 標籤美化 */
.form-label {
    color: #4e73df;
    font-size: 0.9rem;
}

/* 輸入框焦點效果 */
.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.1);
}

/* 程式碼字型設定 */
.font-monospace {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    font-size: 0.9rem;
}

/* 卡片與陰影 */
.card {
    border-radius: 12px;
}

.shadow-sm {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1) !important;
}

/* 按鈕美化 */
.btn-primary {
    background-color: #4e73df;
    border-color: #4e73df;
    border-radius: 8px;
}

.btn-primary:hover {
    background-color: #2e59d9;
    transform: translateY(-1px);
}

/* 當欄位有 readonly 屬性時，改變游標樣式 */
[readonly], .readonly-field {
    cursor: not-allowed; /* 這就是禁止圖示的來源 */
}

/* 針對 Details 動態區域的額外樣式 */
.detail-item {
    border: 1px dashed #dee2e6;
    background-color: #fdfdfd;
    transition: all 0.2s;
}

.detail-item:hover {
    background-color: #f8f9fc;
    border-color: #4e73df;
}

.btn-remove-detail {
    color: #e74a3b;
    cursor: pointer;
}

.btn-remove-detail:hover {
    color: #be2617;
}

.hover-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1) !important;
}

.transition {
    transition: all 0.3s ease;
}

/* 新增紫色系配色 (Indigo) */
.text-indigo {
    color: #6610f2 !important;
}

.bg-indigo {
    background-color: #6610f2 !important;
}

.bg-indigo-light {
    background-color: rgba(102, 16, 242, 0.1);
}

.btn-indigo {
    background-color: #6610f2;
    border-color: #6610f2;
}

.btn-indigo:hover {
    background-color: #520dc2;
    color: white;
}

.hover-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1) !important;
}

.transition {
    transition: all 0.3s ease;
}

.border-dashed {
    border: 2px dashed #dee2e6;
}

.hover-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.transition {
    transition: all 0.3s ease;
}

/* 輕量化 Badge 樣式 */
.bg-success-soft {
    background-color: #e8fadf;
}

.bg-danger-soft {
    background-color: #fbeae9;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* 搜尋框寬度控制 */
.search-box {
    width: 300px;
}

/* 滑過效果 */
#codeTable tbody tr {
    transition: background-color 0.2s;
}

/* 固定表頭樣式 */
.sticky-top {
    top: 0;
    z-index: 10;
    background-color: #f8f9fa !important;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

/* 表格美化 */
.custom-table thead th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    background-color: #f8f9fa;
    color: #6c757d;
    padding: 1rem 0.75rem;
}

.custom-table tbody td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #f2f2f2;
}

/* 捲動軸美化 */
.table-responsive::-webkit-scrollbar {
    width: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border-radius: 10px;
}

/* 標籤樣式 */
.nav-pills .nav-link {
    color: #6c757d;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
}

    .nav-pills .nav-link.active {
        background-color: #198754; /* Success Green */
        color: white;
    }

/* 柔和顏色 Badge */
.bg-info-soft {
    background-color: #e0f7fa;
}

.bg-warning-soft {
    background-color: #fff3e0;
}

.bg-primary-soft {
    background-color: #e3f2fd;
}

.bg-danger-soft {
    background-color: #fbeae9;
}

.search-box {
    width: 300px;
}

/* 表格字體微調 */
.table th {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    padding: 1rem 0.75rem;
}

.table td {
    padding: 0.85rem 0.75rem;
    border-color: #f1f1f1;
}

/* 捲動軸樣式優化 (適用於 Chrome/Edge) */
.table-responsive::-webkit-scrollbar {
    width: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* Tab 樣式美化 */
.nav-tabs .nav-link {
    border: 1px solid transparent;
    color: #6c757d;
    background-color: #f8f9fa;
    margin-right: 5px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    transition: all 0.2s;
}

    .nav-tabs .nav-link:hover {
        background-color: #e9ecef;
        border-color: #dee2e6 #dee2e6 transparent;
    }

    .nav-tabs .nav-link.active {
        background-color: #ffffff;
        border-color: #dee2e6 #dee2e6 #ffffff;
        color: #198754;
        position: relative;
    }
/* 卡片與 Tab 結合的無縫處理 */
.card.border-top-0 {
    border-top: none;
}

/* 固定表頭樣式 */
.sticky-top {
    top: 0;
    z-index: 10;
    background-color: #f8f9fa !important;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

.table th {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    padding: 1rem 0.75rem;
}

/* 捲動軸樣式 */
.table-responsive::-webkit-scrollbar {
    width: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* 步驟圖標樣式 */
.step-num {
    width: 45px;
    height: 45px;
    line-height: 45px;
    border-radius: 50%;
    font-size: 1.25rem;
    border: 2px solid #dee2e6;
}

/* 輕微卡片懸停感 */
.card {
    transition: transform 0.2s;
}

    .card:hover {
        transform: translateY(-5px);
    }

/* Sidebar 品牌區塊美化 */
.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    background: linear-gradient(to right, #1a1a1a, #2d2d2d);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand-logo {
    background: white;
    padding: 5px;
    border-radius: 8px;
    margin-right: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

/* 側邊欄導覽項目微調 */
.sidebar-nav ul li a {
    padding: 12px 20px;
    transition: all 0.3s ease;
    border-radius: 0 50px 50px 0; /* 現代感：右側圓角 */
    margin-right: 15px;
}

.sidebar-nav ul li.active a {
    background: rgba(13, 110, 253, 0.15);
    color: #0d6efd !important;
    font-weight: 600;
    border-left: 4px solid #0d6efd;
}

/* Footer 美化 */
.admin-footer {
    height: 60px;
    background: #ffffff;
    border-top: 1px solid #edf2f9;
    display: flex;
    align-items: center;
    color: #6c757d;
    font-size: 0.875rem;
}

.footer-copy {
    letter-spacing: 0.3px;
}

/* 側邊欄品牌區域容器 */
.sidebar-brand {
    padding: 1.5rem 1rem;
    display: flex;
    justify-content: center; /* 讓圖片居中 */
    align-items: center;
    background: #212529; /* 保持深色背景感 */
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand-link {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

/* 完整 Logo 圖片樣式 */
.brand-image-full {
    max-width: 85%; /* 寬度控制在側邊欄的 85%，避免太擠 */
    height: auto; /* 保持比例 */
    max-height: 45px; /* 限制高度，避免撐破導覽列 */
    object-fit: contain;
    transition: transform 0.2s ease;
}

    .brand-image-full:hover {
        transform: scale(1.05); /* 滑鼠移上去微幅放大，增加互動感 */
    }


/* --- RWD 核心樣式 --- */

/* 手機版頂部 Header */
.mobile-header {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e3e6f0;
    position: sticky;
    top: 0;
    z-index: 999;
}

/* 遮罩層 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
}

    .sidebar-overlay.show {
        display: block;
    }

/* 響應式媒體查詢 */
@media (max-width: 991.98px) {
    /* 側邊欄變為抽屜式 */
    .admin-sidebar {
        left: -260px; /* 移出畫面 */
        transition: all 0.3s ease-in-out;
        box-shadow: none;
    }

        .admin-sidebar.mobile-active {
            left: 0;
            z-index: 1050;
            box-shadow: 5px 0 15px rgba(0,0,0,0.2);
        }

    /* 主內容區填滿寬度 */
    .admin-main {
        margin-left: 0 !important;
    }

    /* Footer 排版調整 */
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 15px 0;
    }
}

/* 電腦版維持橫向 Footer */
@media (min-width: 992px) {
    .footer-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0 25px;
    }
}

/* 通用表格 RWD 優化 */
.table-responsive {
    border-radius: 8px;
    border: 1px solid #f2f2f2;
}
