/* 系統頁面專屬調整 - 升級為深色玻璃擬態風格 */

.system-page {
    align-items: stretch;
}

.system-sidebar {
    flex: 0 0 250px;
}

.system-sidebar .sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-blue) transparent;
}

.system-sidebar .sidebar-list li {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 5px 10px;
    margin-bottom: 2px;
    line-height: 1.35;
    color: var(--text-muted);
    border: 1px solid transparent;
}

/* 滑鼠移上去時的藍色高亮 */
.system-sidebar .sidebar-list li:hover {
    background: rgba(77, 163, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(77, 163, 255, 0.2);
    transform: translateX(2px);
}

.system-sidebar .sidebar-list li.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 15px rgba(77, 163, 255, 0.3);
}

[data-theme="light"] .system-sidebar .sidebar-list li:hover {
    background: rgba(0, 102, 204, 0.1);
    border-color: rgba(0, 102, 204, 0.25);
}

/* === RWD 手機版優化 === */
@media (max-width: 768px) {
    #content-wrapper {
        flex-direction: column;
        padding: 10px;
    }

    .system-sidebar {
        flex: none;
        width: 100%;
        position: sticky;
        top: 70px;
        z-index: 100;
        margin-bottom: 20px;
    }

    .sidebar {
        background: var(--glass-bg) !important;
        backdrop-filter: blur(10px);
        border: 1px solid var(--glass-border) !important;
        border-radius: 16px !important;
        padding: 0 !important;
    }

    [data-theme="light"] .sidebar {
        background: rgba(255, 255, 255, 0.94) !important;
    }

    .sidebar h2 {
        margin: 0 !important;
        padding: 15px 20px !important;
        font-size: 1.1rem !important;
        color: var(--primary-blue) !important;
        border-bottom: none !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar h2::after {
        content: "▼";
        font-size: 0.8rem;
        transition: transform 0.3s;
    }

    .system-sidebar.open .sidebar h2::after {
        transform: rotate(180deg);
    }

    .system-sidebar.open .sidebar h2 {
        border-bottom: 1px solid var(--glass-border) !important;
    }

    .sidebar-list {
        display: none;
        max-height: 300px;
        overflow-y: auto;
        padding: 10px !important;
    }

    .system-sidebar.open .sidebar-list {
        display: block;
    }

    #content {
        padding: 20px !important;
    }
}

#content {
    flex: 1; /* 🚀 關鍵：讓右側自動填滿剩餘空間 */
    min-height: 700px; /* 🚀 關鍵：設定最小高度，避免框框忽大忽小 */
    display: flex;
    flex-direction: column;
    padding: 40px !important;
}

/* === 內容排版設計 === */
#dynamic-content {
    color: var(--text-main);
    line-height: 1.8;
}

#dynamic-content h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--primary-blue);
    border-bottom: 2px solid rgba(77, 163, 255, 0.3);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    font-weight: 800;
}

#dynamic-content h3 {
    font-size: 1.2rem;
    margin: 30px 0 15px 0;
    padding: 6px 15px;
    border-left: 4px solid var(--primary-blue);
    background: rgba(77, 163, 255, 0.1);
    color: var(--primary-blue);
    border-radius: 0 8px 8px 0;
}

#dynamic-content h4 {
    font-size: 1.05rem;
    margin: 20px 0 10px 0;
    padding: 4px 12px;
    color: var(--text-main);
    background: linear-gradient(90deg, rgba(77, 163, 255, 0.2) 0%, transparent 100%);
    border-left: 3px solid var(--primary-blue);
    display: inline-block;
    border-radius: 4px;
}

/* === 表格設計 === */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 25px 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
}

table th {
    background: rgba(77, 163, 255, 0.15);
    color: var(--primary-blue);
    font-weight: 700;
    padding: 14px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(77, 163, 255, 0.3);
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-separator);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

table tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background: rgba(77, 163, 255, 0.1);
}

table tbody tr:hover td {
    color: var(--text-main);
}

/* === 圖片美化 === */
.system-img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 8px;
    background: var(--glass-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* === 連結樣式 === */
#dynamic-content a {
    color: var(--primary-blue);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-blue);
    transition: all 0.2s ease;
}

#dynamic-content a:hover {
    color: var(--text-main);
    border-bottom-style: solid;
    text-shadow: 0 0 8px rgba(77, 163, 255, 0.5);
}

/* === 特殊組件 === */
.highlight {
    color: #ff6b6b;
    font-weight: bold;
}

.note-text {
    background: var(--tag-clear-bg);
    border-radius: 8px;
    padding: 10px 15px;
    color: var(--highlight-yellow);
    font-size: 0.9rem;
    margin: 15px 0;
    border-left: 3px solid var(--highlight-yellow);
}

figure {
    margin: 30px 0;
}

figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 10px;
}

[data-theme="light"] #system-search-input {
    background: #ffffff !important;
    border-color: var(--glass-border) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] table tbody tr:hover {
    background: rgba(0, 102, 204, 0.08);
}

[data-theme="light"] .system-img {
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}
