/* =========================================
   1. GLOBAL STYLES (ตั้งค่าพื้นฐาน)
   ========================================= */
:root {
  --primary-color: #d32f2f; /* สีแดงธีมหลัก */
  --text-color: #333;
  --bg-color: #f5f5f5;
  --sidebar-width: 260px; /* ตัวแปรความกว้างเมนู */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 16px;
}

/* =========================================
   2. LOGIN PAGE STYLES (เฉพาะหน้า index.html)
   ========================================= */
/* จัดหน้า Login ให้อยู่กึ่งกลางเสมอ */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* กล่อง Login (แก้ให้ตรงกับ class .card ของคุณ) */
.card {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 420px; /* ขนาดกำลังดี */
  text-align: center;
  margin: 20px;
}

/* จัดการโลโก้และหัวข้อ */
.card img {
  width: 100px;
  height: auto;
  margin-bottom: 15px;
}

.card h2 {
  margin-bottom: 25px;
  font-weight: 600;
  color: #444;
}

/* จัดการฟอร์ม */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  border-color: var(--primary-color);
}

/* แถว Checkbox และ ลืมรหัสผ่าน */
.checkbox-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 25px;
}

.checkbox-row a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

/* ปุ่ม Login สีแดง */
.btn-login {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-login:hover {
  background-color: #b71c1c; /* สีแดงเข้มขึ้นเมื่อเอาเมาส์ชี้ */
}

.footer {
  margin-top: 30px;
  font-size: 12px;
  color: #999;
}

/* =========================================
   3. DASHBOARD STYLES (เฉพาะหน้า dashboard.html)
   ========================================= */
/* คอนเทนเนอร์หลักของ Dashboard */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* เมนูแถบซ้าย */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: white;
  box-shadow: 2px 0 10px rgba(0,0,0,0.05);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 30px 0;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-header img {
  width: 70px;
  margin-bottom: 10px;
}

.sidebar-menu {
  list-style: none;
  padding: 20px 0;
}

.sidebar-menu li {
  padding: 12px 25px;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
  border-left: 4px solid transparent;
  display: flex;
  align-items: center;
}

/* สไตล์ตอนเอาเมาส์ชี้เมนู */
.sidebar-menu li:hover {
  background-color: #fce4ec;
  color: var(--primary-color);
}

/* สไตล์เมนูที่กำลังเลือกอยู่ (Active) */
.sidebar-menu li.active {
  background-color: #ffebee;
  border-left-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

/* พื้นที่เนื้อหาด้านขวา */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width); /* เว้นที่ให้เมนูซ้าย */
  padding: 40px;
  display: flex;
  justify-content: center; /* จัด Profile Card ให้อยู่กลางจอ */
  align-items: flex-start; /* เริ่มจากด้านบน */
}

/* การ์ดโปรไฟล์ */
.profile-card {
  background: white;
  width: 100%;
  max-width: 600px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  padding: 50px;
  text-align: center;
  margin-top: 40px;
}

.profile-card img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-color);
  padding: 4px;
  margin-bottom: 20px;
}

.profile-card h2 {
  font-size: 26px;
  color: #333;
  margin-bottom: 10px;
}

.profile-card p {
  color: #666;
  font-size: 16px;
  margin-bottom: 5px;
}

/* ทำให้รองรับมือถือ (Responsive) */
@media (max-width: 768px) {
  .dashboard-container {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    box-shadow: none;
  }
  .main-content {
    margin-left: 0;
    padding: 20px;
  }
}