/* =========================================
   Privacy Page Styles
   依賴: common.css (必須先載入 common.css 才能抓到變數)
   ========================================= */

/* 移除重複定義的 :root，直接使用 common.css 的變數 */

.privacy-content {
    margin-left: var(--sidebar-width);
    height: 100vh;       /* 高度佔滿視窗 */
    overflow-y: auto;    /* 允許垂直捲動 */
    padding: 0px 20px;
    background-color: var(--bg-primary); /* 繼承 common */
    color: var(--text-primary);          /* 繼承 common */
    transition: margin-left 0.3s ease, background-color 0.3s ease;
    display: block;
    justify-content: center;
    
}
/* 自定義捲軸 */
.privacy-content::-webkit-scrollbar { width: 8px; }
.privacy-content::-webkit-scrollbar-track { background: transparent; }
.privacy-content::-webkit-scrollbar-thumb { background-color: var(--text-muted); border-radius: 4px; }

/* 手機版 */
@media (max-width: 768px) {
    .privacy-content {
        margin-left: 0;
        padding-top: 60px; /* 避開手機 Header */
    }
    
    .privacy-container { 
        padding: 30px 20px;
        margin: 20px auto;
        border: none;      /* 手機版可以拿掉邊框，看起來更滿版 */
        box-shadow: none;
    }
}

body.collapsed-mode .privacy-content {
    margin-left: var(--sidebar-collapsed-width);
}

.privacy-container {
    max-width: 900px;
    width: 100%;
    background: var(--bg-card); /* 繼承 common */
    padding: 60px;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-color); /* 繼承 common */
    border: 1px solid var(--border); /* 繼承 common */
    position: relative;
    margin-bottom: 100px;
    margin: 10px auto;
}

@media (max-width: 768px) {
    .privacy-container { padding: 30px 20px; }
}

/* --- Top Bar: Logo & Controls --- */
.privacy-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* ★★★ Logo 修正：大小 & 顯示邏輯 ★★★ */
.privacy-logo img {
    width: 240px;  /* 強制 240px */
    height: auto;
    object-fit: contain;
}

/* 預設 (淺色模式)：顯示 Light，隱藏 Dark */
.logo-light { display: block; }
.logo-dark  { display: none; }

/* 深色模式：隱藏 Light，顯示 Dark */
/* 注意：這裡依賴 html[data-theme="dark"]，這是 common.js 設定的 */
[data-theme="dark"] .logo-light { display: none !important; }
[data-theme="dark"] .logo-dark  { display: block !important; }

/* ------------------------------------- */

.privacy-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.theme-toggle-btn .sun-icon { display: block; }
.theme-toggle-btn .moon-icon { display: none; }

[data-theme="dark"] .theme-toggle-btn .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle-btn .moon-icon { display: block; }

/* Language Select Dropdown */
.lang-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.lang-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
}

.lang-select-wrapper select:hover {
    border-color: var(--primary);
}

.lang-select-wrapper select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45, 95, 63, 0.1); /* 這裡可以用 hex 替代，或者定義新變數 */
}

.select-arrow {
    position: absolute;
    right: 10px;
    pointer-events: none;
    color: var(--text-muted);
    width: 14px;
    height: 14px;
}

.privacy-divider {
    border: 0;
    
    /* 改用 --border-sub，保證深淺色都睇到 */
    border-top: 2px solid var(--primary); 
    
    /* 調整上下距離，讓它在 Logo 和 標題 中間 */
    margin: 20px 0 40px 0; 
    
    width: 100%;
    display: block;
}

/* --- Content Styles --- */
.privacy-header {
    margin-bottom: 40px;
}

.privacy-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 15px;
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
}

.policy-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.privacy-body {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.privacy-body.active {
    display: block;
    opacity: 1;
}

.privacy-body section {
    margin-bottom: 40px;
}

.privacy-body h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-sub);
    padding-bottom: 8px;
}

.privacy-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
}

.privacy-body p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: justify;
}

.privacy-body ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.privacy-body li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.privacy-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.privacy-body a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.privacy-body a:hover {
    text-decoration: underline;
}

/* Alert Box - 這裡稍微定義一下背景色，因為 common.css 可能沒有這些 alert 專用色 */
/* 為了適應深色模式，使用 rgba */
.privacy-alert {
    background-color: rgba(255, 0, 0, 0.05); /* 淡淡的紅色背景 */
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-left: 4px solid #ef4444; /* 紅色邊條 */
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.privacy-footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =========================================
   Back to Chat Button
   ========================================= */
.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    background-color: transparent;
    height: 36px; /* 與其他按鈕等高 */
}

.back-btn:hover {
    background-color: var(--bg-hover);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateX(-2px); /* 微微向左移動效果 */
}

.back-btn svg {
    flex-shrink: 0;
}

/* Mobile 適配 */
@media (max-width: 600px) {
    .back-btn span {
        display: none; /* 手機版只顯示箭頭 Icon，節省空間 */
    }
    .back-btn {
        padding: 8px;
    }
}