/* ===============================================
           DASHBOARD MASTER CSS (Final Version)
   =============================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    color: #333;
}

/* --- 1. Login Page --- */
.login-container { max-width: 400px; margin: 100px auto; padding: 30px; background: white; border-radius: 8px; box-shadow: 0 4px Drgba(0,0,0,0.1); }
.login-container h2 { text-align: center; margin-bottom: 20px; color: #333; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
.login-btn { width: 100%; padding: 12px; background-color: #f5a623; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 1em; font-weight: bold; }
.error-message { color: #e74c3c; text-align: center; margin-top: 10px; min-height: 1.2em; }

/* --- 2. Dashboard Layout --- */
.dashboard-header { background: #333; color: white; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; }
.dashboard-header h1 { font-size: 1.5em; margin: 0; }
#logout-btn { background: #e74c3c; color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; }
.dashboard-container { padding: 30px; }
.dashboard-container h2 { margin-top: 0; margin-bottom: 20px; }

/* --- 3. Stats Bar --- */
.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card { background-color: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); text-align: center; }
.stat-card h4 { margin: 0 0 10px 0; color: #555; font-size: 1em; text-transform: uppercase; }
.stat-card p { margin: 0; font-size: 2em; font-weight: bold; color: #f5a623; }

/* --- 4. Order Table --- */
.order-list-container { background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow-x: auto; }
.order-table { width: 100%; border-collapse: collapse; }
.order-table th, .order-table td { padding: 15px; text-align: left; border-bottom: 1px solid #f0f0f0; white-space: nowrap; }
.order-table th { background-color: #f9f9f9; font-weight: 600; }
.order-table tr:last-child td { border-bottom: none; }
.status-select { padding: 5px; border: 1px solid #ccc; border-radius: 4px; background-color: #fff; }
.view-slip-btn { background: none; border: none; cursor: pointer; font-size: 1.5em; padding: 0; }

/* --- ⭐️ 5. MODAL STYLES (THE FIX!) ⭐️ --- */
.cart-modal-overlay {
    position: fixed; /* 👈 ทำให้มันลอยอยู่กับที่ */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1001; /* 👈 ให้อยู่เหนือทุกอย่าง */
}
.cart-modal {
    position: fixed; /* 👈 ทำให้มันลอยอยู่กับที่ */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 👈 จัดให้อยู่กลางจอเป๊ะๆ */
    width: 90%;
    max-width: 500px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 1002; /* 👈 ให้อยู่เหนือ Overlay */
    display: flex;
    flex-direction: column;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #eee; }
.modal-header h2 { font-family: 'Playfair Display', serif; margin: 0; }
.modal-close-btn { background: none; border: none; font-size: 2em; cursor: pointer; color: #888; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
#slip-modal-image { max-width: 100%; height: auto; border-radius: 8px; }
.hidden {
    display: none !important;
}