/* CSS Variables — ชุดสีใหม่ตามแบบ */
:root {
  --plc-navy:   #2b3035; /* Dark sidebar background */
  --plc-blue:   #0d6efd; /* Active menu / Primary */
  --plc-teal:   #20c997; /* Card 1 */
  --plc-orange: #fd7e14; /* Card 2 */
  --plc-info:   #0dcaf0; /* Card 3 */
  --plc-purple: #6f42c1; /* Card 4 */
  --plc-bg:     #f4f6f9; /* Main background */
  --plc-card:   #ffffff;
  --plc-text:   #333333;
  --plc-muted:  #6c757d;
  --plc-line:   #dee2e6;
  --plc-radius: 12px;
  --plc-shadow: 0 4px 6px rgba(0,0,0,0.05);
  
  --plc-sidebar-width: 250px;
  --plc-header-height: 60px;
}

body {
  font-family: 'Sarabun', sans-serif;
  background-color: var(--plc-bg);
  color: var(--plc-text);
  overflow-x: hidden;
}

/* Layout Shell */
#plc-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
#plc-sidebar {
  width: var(--plc-sidebar-width);
  background-color: var(--plc-navy);
  color: #c2c7d0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.plc-brand {
  height: var(--plc-header-height);
  display: flex;
  align-items: center;
  padding: 0 15px;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.plc-brand:hover { color: white; }
.plc-brand i { font-size: 1.5rem; margin-right: 10px; }

.plc-nav {
  list-style: none;
  padding: 10px 0;
  margin: 0;
  flex-grow: 1;
}

.plc-nav li {
  padding: 2px 10px;
}

.plc-nav a {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  color: #c2c7d0;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.95rem;
}

.plc-nav a:hover {
  background-color: rgba(255,255,255,0.05);
  color: white;
}

.plc-nav a.active {
  background-color: var(--plc-blue);
  color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.plc-nav a i {
  margin-right: 12px;
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

/* Main Content */
#plc-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--plc-sidebar-width));
  transition: all 0.3s ease;
}

/* Topbar */
#plc-topbar {
  height: var(--plc-header-height);
  background-color: var(--plc-card);
  border-bottom: 1px solid var(--plc-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#plc-menu-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--plc-muted);
  cursor: pointer;
  margin-right: 15px;
}

/* Content Area */
#plc-content {
  padding: 20px;
  flex-grow: 1;
  overflow-y: auto;
}

/* Cards & Components */
.plc-card {
  background: var(--plc-card);
  border-radius: var(--plc-radius);
  box-shadow: var(--plc-shadow);
  border: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 24px;
  overflow: hidden;
}

.plc-card-header {
  padding: 15px 20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--plc-line);
  font-weight: 600;
  font-size: 1.05rem;
  color: #495057;
  display: flex;
  align-items: center;
}

.plc-card-header i { margin-right: 8px; }

.plc-card-body {
  padding: 20px;
}

/* Dashboard Widgets (Modern & Beautiful Style) */
.kpi-widget {
  border-radius: 16px;
  position: relative;
  display: block;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  color: white;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.05) 100%);
}

.kpi-widget:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.kpi-widget .inner {
  padding: 24px;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-widget .inner-text {
  flex: 1;
}

.kpi-widget h3 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  white-space: nowrap;
  padding: 0;
  color: white;
}

.kpi-widget p {
  font-size: 1rem;
  margin-bottom: 0;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.kpi-widget .icon {
  z-index: 1;
  font-size: 2.5rem;
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.2);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.kpi-widget .small-box-footer {
  position: relative;
  text-align: center;
  padding: 8px 0;
  color: rgba(255,255,255,0.85);
  display: block;
  z-index: 10;
  background: rgba(0,0,0,0.1);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.kpi-widget .small-box-footer:hover {
  color: #fff;
  background: rgba(0,0,0,0.2);
}

/* Background Colors */
.bg-plc-green { background-color: var(--plc-teal) !important; }
.bg-plc-yellow { background-color: var(--plc-orange) !important; }
.bg-plc-cyan { background-color: var(--plc-info) !important; }
.bg-plc-purple { background-color: var(--plc-purple) !important; }
.bg-plc-blue { background-color: var(--plc-blue) !important; }

/* Buttons */
.btn-plc-primary {
  background-color: var(--plc-blue);
  color: white;
  border: none;
  border-radius: 8px;
}
.btn-plc-primary:hover { background-color: #1d4ed8; color: white; }

/* Status Badges */
.plc-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}
.plc-badge-pending {
  background-color: #fef3c7;
  color: #b45309;
}
.plc-badge-approved {
  background-color: #d1fae5;
  color: #047857;
}

/* Image Preview */
.img-preview-box {
  width: 100%;
  height: 200px;
  border: 2px dashed var(--plc-line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: #fafafa;
  cursor: pointer;
}
.img-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.img-preview-box .btn-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Wizard */
.wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}
.wizard-step {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-bottom: 3px solid var(--plc-line);
  color: var(--plc-muted);
  font-weight: 500;
}
.wizard-step.active {
  border-bottom-color: var(--plc-blue);
  color: var(--plc-blue);
}
.wizard-content { display: none; }
.wizard-content.active { display: block; animation: fadeIn 0.3s; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Sidebar */
@media (max-width: 768px) {
  #plc-menu-toggle { display: block; }
  
  #plc-sidebar {
    position: fixed;
    left: calc(-1 * var(--plc-sidebar-width));
    height: 100vh;
  }
  
  #plc-sidebar.toggled {
    left: 0;
  }
  
  #plc-main {
    width: 100%;
  }
}

/* Toast */
.plc-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

/* ─── Report Stat Cards ─── */
.report-stat-card {
  background: var(--plc-card);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border: 1px solid var(--plc-line);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.report-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.report-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent, var(--plc-blue));
  border-radius: 14px 0 0 14px;
}
.report-stat-icon {
  font-size: 1.8rem;
  color: var(--accent, var(--plc-blue));
  opacity: 0.85;
  margin-bottom: 6px;
}
.report-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--plc-text);
}
.report-stat-label {
  font-size: 0.85rem;
  color: var(--plc-muted);
  margin-top: 2px;
}

/* ─── Print Styles ─── */
@media print {
  #plc-sidebar, #plc-topbar, .no-print { display: none !important; }
  #plc-main { width: 100% !important; }
  #plc-content { padding: 0 !important; }
  .plc-card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
  .report-stat-card { box-shadow: none !important; border: 1px solid #ddd !important; }
  canvas { max-width: 100% !important; }
}
