:root {
  --primary-color: #0d47a1;
  --secondary-color: #1976d2;
  --accent-color: #f0a500;
  --light-color: #f8f9fa;
  --dark-color: #333;
  --border-color: rgba(0,0,0,0.125);
  --hover-color: #1565c0;
  --success-color: #1b5e20;
  --warning-color: #e65100;
  --danger-color: #b71c1c;
  --gray-bg: #f5f5f5;
  --danger-text: #ff6b6b;
}

body { 
  font-family: 'Kanit', sans-serif; 
  background-color: var(--light-color);
  margin: 0; 
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  color: var(--dark-color);
}

    .sidebar {
      height: 100vh;
  background-color: var(--primary-color);
      color: white;
      padding-top: 20px;
      position: fixed;
  width: 250px;
  z-index: 1100;
  overflow-y: auto;
  transition: all 0.3s ease;
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  left: 0;
  top: 0;
}

/* CSS สำหรับ sidebar ที่ถูกย่อ */
.sidebar.collapsed {
  width: 70px !important;
  overflow: visible;
  min-width: 70px !important;
  max-width: 70px !important;
}

.sidebar.collapsed .menu-text {
  display: none !important;
  opacity: 0;
  visibility: hidden;
}

.sidebar.collapsed .menu-label {
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
}

.sidebar.collapsed .sidebar-header h5 {
  display: none;
}

.sidebar.collapsed .sidebar-toggle {
  margin: 0 auto;
  width: 40px;
  height: 40px;
}

.sidebar.collapsed a {
  text-align: center;
  padding: 15px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.sidebar.collapsed a:hover, .sidebar.collapsed .active {
  padding-left: 0;
  border-left: 0;
  transform: translateX(0);
  background-color: var(--hover-color);
}

.sidebar.collapsed .menu-icon {
  margin-right: 0;
  font-size: 1.2rem;
  width: auto;
}

.sidebar h5 {
  color: #fff;
  margin: 0;
  padding: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  margin-bottom: 10px;
  height: 50px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.3s;
  width: 36px;
  height: 36px;
}

.sidebar-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.sidebar-toggle:active {
  transform: scale(0.95);
}

.sidebar-toggle .menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.3rem;
}

    .sidebar a {
      color: white;
      text-decoration: none;
      display: block;
  padding: 10px 20px;
  transition: all 0.3s;
  border-left: 0px solid transparent;
  font-size: 15px;
  margin-bottom: 2px;
}

    .sidebar a:hover {
  background-color: var(--hover-color);
  border-left: 4px solid var(--accent-color);
  padding-left: 16px;
  transform: translateX(2px);
}

.sidebar .active {
  background-color: var(--hover-color);
  border-left: 4px solid var(--accent-color);
  padding-left: 16px;
}

.menu-section {
  margin-bottom: 15px;
}

.menu-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  padding: 0 20px;
  margin-bottom: 5px;
  text-transform: uppercase;
  font-weight: 500;
    }

.menu-icon {
  display: inline-block;
  width: 24px;
  text-align: center;
  margin-right: 5px;
  font-style: normal; /* ป้องกันไม่ให้ไอคอนเอียง */
  font-weight: normal;
}

.logout-link {
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 15px;
  color: var(--danger-text) !important;
}

    .topbar {
  height: 50px;
  background-color: var(--primary-color);
      color: white;
  padding: 0 25px;
      position: fixed;
  left: 250px;
      right: 0;
      z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s;
}

.topbar .site-title {
  display: flex;
  align-items: center;
  height: 100%;
}

.topbar .site-title h4 {
  color: white;
  font-weight: 600;
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.3;
}

.topbar .user-info-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.topbar .user-info {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 30px;
  padding: 5px 15px 5px 5px;
  transition: all 0.3s;
}

.topbar .user-info:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.topbar .user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  margin-left: 10px;
}

.topbar .user-details strong {
  display: block;
  font-size: 0.9rem;
  color: white;
}

.topbar .user-details small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
}

.topbar .user-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

    .main-content {
  margin-left: 250px;
      padding: 80px 30px 30px;
  transition: all 0.3s;
  min-height: calc(100vh - 60px);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.card, .form-control, .btn, .alert {
  border-radius: 0.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: all 0.3s;
}

.card {
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.card-header {
  background-color: var(--light-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-header.bg-primary {
  background-color: var(--primary-color) !important;
  color: white;
}

.card-header.bg-secondary {
  background-color: var(--secondary-color) !important;
  color: white;
}

.table {
  background-color: #fff;
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 0;
}

.table thead th {
  font-weight: 600;
  color: var(--primary-color);
}

.table-light {
  background-color: var(--gray-bg);
}

.table td, .table th {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.form-container {
  background-color: #fff;
  padding: 20px;
  border-radius: 0.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.form-control, .form-select {
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  border: 1px solid #ced4da;
  transition: all 0.3s;
  font-size: 15px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 0.2rem rgba(58, 110, 165, 0.25);
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  font-size: 15px;
}

.btn {
  border-radius: 0.25rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: all 0.3s;
  font-size: 15px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--hover-color);
  border-color: var(--hover-color);
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #0d47a1;
  border-color: #0d47a1;
}

.btn-warning {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.btn-warning:hover {
  background-color: #d89400;
  border-color: #d89400;
  color: white;
}

.btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
}

.btn-danger:hover {
  background-color: #c82333;
  border-color: #bd2130;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s;
}

@media (max-width: 992px) {
  .sidebar {
    width: 200px;
  }
  
  .topbar {
    left: 200px;
  }
  
  .main-content {
    margin-left: 200px;
    padding: 80px 20px 20px;
  }
  
  .card-body {
    padding: 15px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding-bottom: 10px;
  }
  
  .sidebar h5 {
    text-align: center;
  }
  
  .menu-label {
    text-align: center;
    padding: 0 10px;
  }
  
  .sidebar a {
    display: inline-block;
    width: auto;
    text-align: center;
    padding: 10px 15px;
    margin: 0 5px;
  }
  
  .sidebar a:hover, .sidebar .active {
    border-left: none;
    border-bottom: 2px solid var(--accent-color);
    padding-left: 15px;
    transform: none;
  }
  
  .topbar {
    left: 0;
    position: relative;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  
  .main-content {
    margin-left: 0;
    padding: 20px;
  }
  
  .topbar .site-title h4 {
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 10px;
  }
  
  .card-body {
    padding: 15px;
  }
  
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  .topbar {
    padding: 0 15px;
    height: auto;
    min-height: 60px;
    padding-bottom: 10px;
  }
  
  .topbar .site-title {
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
    justify-content: center;
  }
  
  .topbar .user-info-container {
    width: 100%;
    justify-content: center;
  }
  
  .row {
    margin-left: -10px;
    margin-right: -10px;
  }
  
  .col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, 
  .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11,
  .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, 
  .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, 
  .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, 
  .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, 
  .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, 
  .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, 
  .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, 
  .col-xl-8, .col-xl-9, .col-xl-auto {
    padding-right: 10px;
    padding-left: 10px;
  }
}

/* สไตล์สำหรับปุ่มไอคอนในตาราง */
.action-btn {
  transition: all 0.3s ease;
  border-radius: 4px;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.action-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.action-btn i {
  font-size: 1rem;
}

/* ปุ่มดูรายละเอียด */
.view-btn {
  background-color: var(--success-color);
  color: white;
  border: none;
}

.view-btn:hover {
  background-color: #2e7d32;
  color: white;
}

/* ปุ่มดึงกลับมาแก้ไข */
.pullback-btn {
  background-color: var(--danger-color);
  color: white;
  border: none;
}

.pullback-btn:hover {
  background-color: #c62828;
  color: white;
}

/* ปุ่มแก้ไข */
.edit-btn {
  background-color: var(--secondary-color);
  color: white;
  border: none;
}

.edit-btn:hover {
  background-color: var(--hover-color);
  color: white;
}

/* ปุ่มลบ */
.delete-btn {
  background-color: #f44336;
  color: white;
  border: none;
}

.delete-btn:hover {
  background-color: #d32f2f;
  color: white;
}

/* ปุ่มมอบหมาย */
.assign-btn {
  background-color: var(--accent-color);
  color: white;
  border: none;
}

.assign-btn:hover {
  background-color: #e59400;
  color: white;
}

/* สไตล์สำหรับ btn-group ในตาราง */
.table .btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-start;
}

@media (max-width: 576px) {
  .table .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .table .action-btn {
    width: 100%;
    justify-content: center;
    margin-left: 0 !important;
  }
}

/* สไตล์สำหรับแสดงสถานะ */
.badge {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  white-space: nowrap;
  text-shadow: none;
}

.badge i {
  font-size: 0.9rem;
  margin-right: 5px;
}

.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* สถานะ - รอผู้อำนวยการพิจารณา */
.status-waiting-director {
  background-color: #ff9800;
  color: #000000;
  font-weight: 600;
}

/* สถานะ - รอแก้ไข */
.status-waiting-edit {
  background-color: #f44336;
  color: #ffffff;
  font-weight: 600;
}

/* สถานะ - รอเกษียณ */
.status-waiting-annotation {
  background-color: #03a9f4;
  color: #000000;
  font-weight: 600;
}

/* สถานะ - รอดำเนินการ */
.status-in-progress {
  background-color: #757575;
  color: #ffffff;
  font-weight: 600;
}

/* สถานะ - เสร็จสิ้น */
.status-completed {
  background-color: #4caf50;
  color: #ffffff;
  font-weight: 600;
}

/* สถานะ - จัดเก็บแล้ว */
.status-archived {
  background-color: #2e7d32;
  color: #ffffff;
  font-weight: 600;
}

/* แสดงจำนวนการแจ้งเตือน */
.badge-counter {
  position: relative;
  top: -8px;
  right: 5px;
  padding: 3px 6px;
  border-radius: 10px;
  background-color: #f44336;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
}

/* บังคับสีข้อความในแต่ละสถานะ */
.status-waiting-director,
.status-waiting-annotation {
  color: #000000 !important;
}

.status-waiting-edit,
.status-in-progress,
.status-completed,
.status-archived {
  color: #ffffff !important;
}

/* ตัวหนาสำหรับข้อความในสถานะ */
.badge span, 
.badge strong {
  color: inherit;
  font-weight: 600;
}
