@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap');

:root {
  --kc-primary: #0e2a5e;
  --kc-primary-dark: #091a3e;
  --kc-primary-light: #1d4ed8;
  --kc-accent: #f59e0b;
  --kc-accent-dark: #d97706;
  --kc-accent-light: #fef3c7;
  --kc-bg: #f8fafc;
  --kc-card-bg: #ffffff;
  --kc-text: #1e293b;
  --kc-text-muted: #64748b;
  --kc-border: #e2e8f0;
}

body {
  font-family: 'Bai Jamjuree', sans-serif;
  background-color: var(--kc-bg);
  color: var(--kc-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* แก้ปัญหาสระบน/สระล่าง (สระอุ, สระอู, ญ, ฐ, วรรณยุกต์) ถูกตัดขอบ */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  line-height: 1.45;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-bottom: 3px;
}

main {
  flex: 1 0 auto;
}

/* Sticky Header & Navbar (Always Visible On Scroll) */
header.sticky-top {
  position: sticky !important;
  top: 0 !important;
  z-index: 1030 !important;
}

.navbar-kc {
  background: linear-gradient(135deg, var(--kc-primary-dark) 0%, var(--kc-primary) 100%);
  box-shadow: 0 4px 20px rgba(14, 42, 94, 0.25);
  padding: 0.8rem 1rem;
  backdrop-filter: blur(12px);
}

.navbar-kc .navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-kc .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.navbar-kc .nav-link:hover,
.navbar-kc .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.navbar-kc .nav-link.btn-admin {
  background: linear-gradient(135deg, var(--kc-accent) 0%, var(--kc-accent-dark) 100%);
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.navbar-kc .nav-link.btn-admin:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}

/* Hero Section */
.hero-banner {
  background: linear-gradient(135deg, #0e2a5e 0%, #1e40af 50%, #1e3a8a 100%);
  color: #ffffff;
  padding: 4.5rem 1rem 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: var(--kc-bg);
  clip-path: polygon(0 100%, 100% 100%, 100% 0);
}

.badge-kc-gold {
  background-color: var(--kc-accent);
  color: #ffffff;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

/* Stat Cards */
.stat-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--kc-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(14, 42, 94, 0.08);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

/* Task Cards */
.task-card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid var(--kc-border);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.task-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 30px rgba(14, 42, 94, 0.12);
  border-color: #cbd5e1;
}

.task-card-img-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background-color: #0f172a;
}

.task-card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.task-card:hover .task-card-img-wrapper img {
  transform: scale(1.06);
}

.task-category-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  backdrop-filter: blur(8px);
  background: rgba(14, 42, 94, 0.85);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.task-date-pill {
  position: absolute;
  bottom: 12px;
  right: 14px;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.7);
  color: #f1f5f9;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 8px;
}

.task-card-body {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.task-card-title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--kc-primary-dark);
  line-height: 1.45;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-meta {
  font-size: 0.85rem;
  color: var(--kc-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 1rem;
}

/* Officers Showcase Section in Cards & Detail */
.officers-block {
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  padding: 0.9rem;
  margin-top: auto;
  margin-bottom: 1rem;
}

.officers-block-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--kc-text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.officer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.officer-row:last-child {
  margin-bottom: 0;
}

.officer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.officer-badge-1 {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.officer-badge-2 {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
}

.officer-badge-3 {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: #ffffff;
}

.officer-name {
  font-weight: 500;
  color: var(--kc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.officer-role-label {
  font-size: 0.75rem;
  color: var(--kc-text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

/* Detail Page Large Officer Card */
.officer-detail-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--kc-border);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  transition: all 0.25s ease;
}

.officer-detail-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(14, 42, 94, 0.08);
}

.officer-detail-card.order-1 {
  border-left: 5px solid var(--kc-accent);
  background: linear-gradient(to right, rgba(254, 243, 199, 0.25), #ffffff);
}

.officer-detail-card.order-2 {
  border-left: 5px solid var(--kc-primary-light);
}

.officer-detail-card.order-3 {
  border-left: 5px solid #64748b;
}

.officer-avatar-box {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--kc-primary);
  flex-shrink: 0;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Admin Sidebar & Layout */
.admin-sidebar {
  background: linear-gradient(180deg, var(--kc-primary-dark) 0%, var(--kc-primary) 100%);
  min-height: calc(100vh - 65px);
  color: #ffffff;
  padding: 1.5rem 1rem;
}

.admin-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

.admin-sidebar .nav-link i {
  font-size: 1.2rem;
}

/* Category Filter Tabs */
.filter-pill {
  background: #ffffff;
  color: var(--kc-text);
  border: 1px solid var(--kc-border);
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.filter-pill:hover,
.filter-pill.active {
  background: var(--kc-primary);
  color: #ffffff;
  border-color: var(--kc-primary);
  box-shadow: 0 4px 12px rgba(14, 42, 94, 0.2);
}

/* Footer */
footer.kc-footer {
  background: var(--kc-primary-dark);
  color: #94a3b8;
  padding: 3rem 1rem 1.5rem;
  font-size: 0.92rem;
  margin-top: auto;
}

footer.kc-footer a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.2s;
}

footer.kc-footer a:hover {
  color: var(--kc-accent);
}

/* Service Details List Styling */
.service-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.service-detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 1.45em;
  flex-shrink: 0;
}
.service-detail-icon i {
  font-size: 0.78rem;
  line-height: 1;
  display: inline-flex;
}
.service-detail-icon i::before {
  vertical-align: 0 !important;
}
.service-detail-text {
  line-height: 1.45;
  flex-grow: 1;
}

/* Print Styling for Official Report */
@media print {
  .no-print, header, footer, .navbar-kc, .btn, .breadcrumb {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 14pt;
  }
  .print-container {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
}

/* =========================================================
   MODERN & FUTURISTIC ADMIN DESIGN SYSTEM
   ========================================================= */

/* Modern Admin Navbar */
.admin-navbar {
  background: linear-gradient(135deg, #070f26 0%, #0d1e4c 60%, #10245a 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(7, 15, 38, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.65rem 1rem;
}

.admin-brand-logo {
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  transition: transform 0.25s ease;
}

.admin-brand-logo:hover {
  transform: scale(1.06) rotate(3deg);
}

.admin-nav-link {
  color: rgba(255, 255, 255, 0.8) !important;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: 999px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.admin-nav-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.admin-nav-link.active {
  color: #60a5fa !important;
  background: rgba(59, 130, 246, 0.16) !important;
  border: 1px solid rgba(96, 165, 250, 0.35);
  font-weight: 600;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.25);
}

/* Pulsing Status Dot */
.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Modern Admin Hero / Welcome Banner */
.admin-hero-banner {
  background: linear-gradient(135deg, #091a3e 0%, #132e6b 55%, #1d4ed8 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(9, 26, 62, 0.18);
  position: relative;
  overflow: hidden;
}

.admin-hero-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.25) 0%, rgba(96, 165, 250, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* Modern Futuristic Stat Cards */
.admin-stat-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.admin-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.28s ease;
}

.admin-stat-card:hover {
  transform: translateY(-4px);
}

/* Specific Card Glow Colors */
.stat-card-blue:hover {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 14px 30px -4px rgba(37, 99, 235, 0.16);
}
.stat-card-blue::before {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.stat-card-green:hover {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 14px 30px -4px rgba(16, 185, 129, 0.16);
}
.stat-card-green::before {
  background: linear-gradient(90deg, #059669, #34d399);
}

.stat-card-amber:hover {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 14px 30px -4px rgba(245, 158, 11, 0.16);
}
.stat-card-amber::before {
  background: linear-gradient(90deg, #d97706, #fbbf24);
}

.stat-card-indigo:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 14px 30px -4px rgba(99, 102, 241, 0.16);
}
.stat-card-indigo::before {
  background: linear-gradient(90deg, #4f46e5, #818cf8);
}

/* Stat Icon Modern Box */
.stat-icon-modern {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.admin-stat-card:hover .stat-icon-modern {
  transform: scale(1.08) rotate(2deg);
}

.stat-icon-blue {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(59, 130, 246, 0.22) 100%);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.stat-icon-green {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(52, 211, 153, 0.22) 100%);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.stat-icon-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(251, 191, 36, 0.22) 100%);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.stat-icon-indigo {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(129, 140, 248, 0.22) 100%);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Modern Action Buttons */
.btn-modern-primary {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #3b82f6 100%);
  color: #ffffff !important;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.22s ease;
}

.btn-modern-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-modern-light {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  transition: all 0.22s ease;
}

.btn-modern-light:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1.5px);
}

/* Modern Table Hover */
.table-modern tbody tr {
  transition: background-color 0.18s ease;
}

.table-modern tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.75) !important;
}

/* Quick Action Circle Icon Buttons */
.btn-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.btn-action-icon:hover {
  transform: scale(1.1);
}

/* Fractional Spacing Utilities */
.p-2\.5 { padding: 0.65rem !important; }
.px-2\.5 { padding-left: 0.65rem !important; padding-right: 0.65rem !important; }
.py-2\.5 { padding-top: 0.65rem !important; padding-bottom: 0.65rem !important; }
.p-3\.5 { padding: 1.15rem !important; }
.px-3\.5 { padding-left: 1.15rem !important; padding-right: 1.15rem !important; }
.gap-2\.5 { gap: 0.65rem !important; }
