/* 全局設定 */
body { 
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif; 
    background-color: #f4f6f9; 
    height: 100vh;
    overflow: hidden; /* 防止出現雙重捲軸 */
}

/* 🔥 關鍵修正：讓主畫面變成左右排版 */
#app-screen {
    display: flex; 
    width: 100%; 
    height: 100%;
}

/* --- 側邊欄 (左側) --- */
.sidebar { 
    width: 250px; 
    background-color: #343a40; /* 經典深灰 */
    color: white; 
    display: flex; 
    flex-direction: column; 
    height: 100%; /* 佔滿高度 */
    flex-shrink: 0; /* 禁止縮小 */
}

/* 標題區塊 */
.sidebar h4 {
    background-color: #212529; 
    margin: 0;
    padding: 20px 0;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
}

/* 選單按鈕 */
.sidebar .nav-link { 
    color: #c2c7d0; 
    padding: 16px 20px; 
    font-size: 1rem; 
    cursor: pointer; 
    transition: 0.2s; 
    width: 100%;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    text-decoration: none; /* 去除底線 */
}

.sidebar .nav-link:hover { 
    background-color: rgba(255,255,255,0.1); 
    color: white; 
}

/* 🔥 選中狀態：亮藍色 */
.sidebar .nav-link.active { 
    background-color: #0d6efd; 
    color: white; 
    font-weight: bold;
}

.sidebar .nav-link i { 
    margin-right: 15px; 
    width: 20px; 
    text-align: center; 
}

/* 登出按鈕 (推到底部) */
#btn-logout {
    margin-top: auto; 
    background-color: #c0392b;
    color: white;
    justify-content: center;
}
#btn-logout:hover { background-color: #e74c3c; }

/* --- 主內容區 (右側) --- */
.main-content { 
    flex-grow: 1; /* 自動填滿剩餘空間 */
    padding: 30px; 
    overflow-y: auto; /* 內容太多時出現捲軸 */
    background-color: #f4f6f9;
    height: 100%;
}

/* 卡片 */
.card { 
    border: none; 
    border-radius: 8px; 
    box-shadow: 0 0 10px rgba(0,0,0,0.05); 
    background: white;
}

/* 登入畫面 */
#login-screen { 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: #e9ecef; 
    z-index: 9999; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.text-purple { color: #6f42c1; }
.btn-purple { background-color: #6f42c1; color: white; border: none; }
.btn-purple:hover { background-color: #59359a; color: white; }

/* 頁面切換動畫 */
.page-section { display: none; animation: fadeIn 0.3s; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* 列印設定 */
.receipt-paper, .quotation-paper { background: white; padding: 40px; border: 1px solid #ddd; width: 100%; max-width: 800px; }
@media print { 
    body * { visibility: hidden; } 
    .modal-content * { visibility: visible; } 
    .modal-content { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: none; } 
    .modal-footer, .btn-close { display: none; } 
}