/**
 * Project: Fresh Weekly (cltip.pm)
 * Description: 現代化管理系統樣式表 - 整合登入與後台框架
 */

/* 1. 變數與基礎設定 */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --success: #27ae60;
    --bg-light: #f5f7fa;
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --glass: rgba(255, 255, 255, 0.88);
    --shadow-lg: 0 15px 35px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: "PingFang TC", "Microsoft JhengHei", sans-serif; }

body { background: var(--bg-light); color: var(--text-dark); height: 100vh; overflow: hidden; }

/* 2. 背景輪播 (修復顯示問題) */
.bg-slideshow {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1; /* 確保在底層 */
    list-style: none;
    padding: 0;
    margin: 0;
}

.bg-slideshow li {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.bg-slideshow li.active { opacity: 1; }

/* 3. 登入介面佈局 */
.login-wrapper {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 100%;
    max-width: 420px;
    padding: 45px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.login-card h2 { font-size: 28px; margin-bottom: 10px; color: #1a2a3a; }
.login-card p { color: var(--text-muted); margin-bottom: 30px; font-size: 14px; }

.input-group { margin-bottom: 20px; text-align: left; }
.input-group label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: #555; }

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    background: rgba(255,255,255,0.5);
    font-size: 16px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3); }
.login-footer { margin-top: 25px; font-size: 13px; }
.login-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* 4. 後台主框架樣式 */
.wrapper { display: flex; height: 100vh; }

#sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.sidebar-header { padding: 20px; font-size: 1.5rem; font-weight: bold; border-bottom: 1px solid #3e4f5f; text-align: center; }

.menu-link {
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    transition: 0.2s;
    border-left: 4px solid transparent;
}

.menu-link:hover, .menu-link.active {
    background: #3e4f5f;
    border-left: 4px solid var(--primary);
}

#main { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; }

.top-bar {
    background: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.content-body { padding: 20px; overflow-y: auto; flex-grow: 1; }

.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 5. 動態效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}





/* --- 基礎佈局變動 --- */
:root {
    --sidebar-width: 260px;
}

/* --- 手機版遮罩 --- */
#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998; /* 低於側邊欄，高於內容 */
}

/* --- 側邊欄基礎位置 --- */
#sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 999;
    transition: transform 0.3s ease;
}

/* --- 內容區偏移 --- */
#main {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* --- 頂部按鈕樣式 --- */
.mobile-toggle {
    display: none; /* 電腦版隱藏 */
    background: none; border: none;
    font-size: 24px; color: #333;
    cursor: pointer; padding: 0 15px;
}

/* --- 📱 手機版 RWD (關鍵點：768px 以下) --- */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%); /* 隱藏到左側外 */
    }
    
    #main {
        margin-left: 0; /* 手機版內容全滿 */
    }
    
    .mobile-toggle {
        display: block; /* 手機版顯示漢堡鈕 */
    }

    /* 當選單被打開時的狀態 */
    .menu-open #sidebar {
        transform: translateX(0); /* 滑入 */
    }
    
    .menu-open #sidebar-overlay {
        display: block; /* 顯示遮罩 */
    }
}