/* ==========================================
   🎯 1. VARIABLE CONFIGURATIONS (ธีมสีเหลืองมินิมอล)
   ========================================== */
:root {
  /* แผงสีหลัก (Yellow Minimalist Palette) */
  --primary: #eab308; /* สีเหลืองหลักสำหรับเน้นจุดสำคัญ */
  --primary-dark: #b45309; /* สีน้ำตาลทองอบอุ่นสำหรับตัวหนังสือเด่น */
  --primary-light: #fef9c3; /* สีเหลืองพาสเทลอ่อนสำหรับพื้นหลังการ์ด */
  --success: #84cc16; /* สีเขียวมะนาวซอฟต์ ๆ */
  --warning: #f59e0b; /* สีส้มอมเหลือง */
  --danger: #f43f5e; /* สีแดงอมชมพูละมุนสำหรับเคสเกินเวลา */

  /* สีพื้นหลังและตัวอักษรแบบคลีน */
  --bg-main: #fefefb; /* สีขาวนวลออกครีมจาง ๆ สบายตา */
  --card-bg: #ffffff; /* สีขาวสะอาดสำหรับการ์ดแยก */
  --text-dark: #1e293b; /* สีเทาเข้มเกือบดำ (นุ่มนวลกว่าสีดำสนิท) */
  --text-muted: #78716c; /* สีเทาอมน้ำตาลสำหรับตัวหนังสือรอง */
  --border: #f1f0e8; /* เส้นขอบสีครีมบาง ๆ */
}

/* ==========================================
   ✨ 2. GLOBAL RESET & BASE STYLES
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Kanit", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  padding: 2rem 1rem;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ==========================================
   💻 3. HEADER COMPONENT
   ========================================== */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 1.5rem 2rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(234, 179, 8, 0.02); /* เงาสีเหลืองจาง ๆ */
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

.admin-header .brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-header .brand i {
  font-size: 2.2rem;
  color: var(--primary);
}

.admin-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
}

.admin-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.admin-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 0.5rem 1.2rem;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid rgba(234, 179, 8, 0.15);
}

/* ==========================================
   📊 4. STATS CARDS SECTION
   ========================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.02);
}

.stat-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

/* คุมโทนสีไอคอนสไตล์พาสเทลเหลือง-ครีม-เขียวซอฟต์ */
.stat-card.total .icon {
  background: #fef9c3;
  color: #ca8a04;
}
.stat-card.borrowing .icon {
  background: #fef3c7;
  color: #d97706;
}
.stat-card.available .icon {
  background: #f0fdf4;
  color: #16a34a;
}

.stat-card .num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-dark);
  display: block;
}

.stat-card .lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ==========================================
   📦 5. LAYOUT GRID CONTROL & PANELS
   ========================================== */
.main-content-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .main-content-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--card-bg);
  padding: 1.75rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
}

.panel h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ==========================================
   📋 6. TABLE CONFIGURATIONS (ฝั่งซ้าย)
   ========================================== */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  font-size: 0.95rem;
  color: var(--text-dark);
}

/* ปุ่มปรับแต่งสต็อกมินิมอล */
.stock-ctrl {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-stock {
  width: 28px;
  height: 28px;
  border: 1px solid #e7e5e4;
  background: var(--card-bg);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-dark);
  transition: all 0.15s ease;
}

.btn-stock:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* ==========================================
   👥 7. RIGHT PANEL (รายการนักศึกษาค้างส่งคืน)
   ========================================== */
.user-borrow-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.user-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
  background: #fdfdf9; /* สีขาวครีมจาง ๆ คลีน ๆ */
  transition: all 0.2s ease;
}

.user-card:hover {
  border-color: rgba(234, 179, 8, 0.25);
  background: #fffbeb; /* ไฮไลท์การ์ดสีเหลืองน้ำนวลตอนเอาเมาส์ชี้ */
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.user-card-header b {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
}

.user-card-header .uid-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--card-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.user-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.item-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ป้าย Tag รายการอุปกรณ์สไตล์มินิมอลธีมเหลือง */
.item-sub-badge {
  background: var(--primary-light);
  border: 1px solid rgba(234, 179, 8, 0.15);
  color: var(--primary-dark);
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* กรณีส่งคืนเกินเวลา (Overdue) ให้ตัดส้มแดงแบบละมุนตา */
.item-sub-badge.overdue {
  border-color: rgba(244, 63, 94, 0.15);
  background: #fff1f2;
  color: var(--danger);
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================
   ⚙️ 8. CUSTOM SCROLLBAR CONFIG
   ========================================== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #e7e5e4;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #d6d3d1;
}
