/* =========================================================
   VelyClinic Theme — เขียว/ขาว สไตล์โรงพยาบาล ทันสมัย
   ========================================================= */

:root {
  --green-900: #063f30;
  --green-800: #084a39;
  --green-700: #0a5c44;
  --green-600: #0e7a58;
  --green-500: #12996e;
  --green-400: #2eb886;
  --green-200: #a7e3cc;
  --green-100: #d9f3e8;
  --green-50: #f0faf6;
  --mint-bg: #f4f9f7;
  --ink: #1c2b27;
  --radius: 1rem;
  --shadow-sm: 0 1px 3px rgba(6, 63, 48, .06), 0 4px 14px rgba(6, 63, 48, .05);
  --shadow-md: 0 6px 24px rgba(6, 63, 48, .10);
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Sarabun', 'Leelawadee UI', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--mint-bg);
}

h1, h2, h3, h4, h5, h6, .stat-value, .navbar-brand {
  font-family: 'Prompt', 'Sarabun', 'Leelawadee UI', sans-serif;
}

h3 {
  font-weight: 600;
  color: var(--green-900);
}

/* ---------- Sidebar ---------- */
#sidebar {
  width: 250px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--green-700) 0%, var(--green-900) 100%);
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(6, 63, 48, .18);
}

#sidebar .fs-4 {
  letter-spacing: .02em;
}

#sidebar .nav-link {
  padding: .42rem .8rem;
  border-radius: .6rem;
  font-size: .95rem;
  position: relative;
  transition: background .18s ease, transform .18s ease;
}

#sidebar .nav-link:hover {
  background: rgba(255, 255, 255, .14);
  transform: translateX(4px);
}

#sidebar .nav-link.active {
  background: rgba(255, 255, 255, .18);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--green-200);
}

.sidebar-heading {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--green-200);
  margin-top: .9rem;
  padding: 0 .8rem;
  list-style: none;
  opacity: .9;
}

@media (max-width: 991.98px) {
  #sidebar {
    position: fixed;
    z-index: 1040;
    left: -270px;
    transition: left .25s ease;
    height: 100vh;
    overflow-y: auto;
  }

  #sidebar.show {
    left: 0;
  }
}

/* ---------- Topbar ---------- */
#main-area > header {
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, .85) !important;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--green-100) !important;
}

/* ---------- เนื้อหาหลัก + แอนิเมชันเปิดหน้า ---------- */
main {
  animation: fadeUp .35s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Cards ---------- */
.card {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--green-50);
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-family: 'Prompt', 'Sarabun', sans-serif;
}

/* ---------- Dashboard stat cards ---------- */
.stat-card {
  border: 0;
  border-radius: 1.1rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}

.stat-card .stat-icon {
  position: absolute;
  right: .9rem;
  bottom: .5rem;
  font-size: 2.2rem;
  opacity: .5;
}

.stat-card .stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: .01em;
}

.stat-emerald {
  background: linear-gradient(135deg, var(--green-600), var(--green-900));
}

.stat-teal {
  background: linear-gradient(135deg, #0d8a8a, #064e4e);
}

.stat-jade {
  background: linear-gradient(135deg, var(--green-400), var(--green-700));
}

.stat-sage {
  background: linear-gradient(135deg, #4c9a6e, #1f5c3d);
}

/* ---------- ปุ่ม ---------- */
.btn {
  border-radius: .55rem;
  transition: transform .15s ease, box-shadow .15s ease;
}

.btn:not(.btn-sm):hover {
  transform: translateY(-1px);
}

.btn-primary {
  --bs-btn-bg: var(--green-600);
  --bs-btn-border-color: var(--green-600);
  --bs-btn-hover-bg: var(--green-700);
  --bs-btn-hover-border-color: var(--green-700);
  --bs-btn-active-bg: var(--green-800);
  --bs-btn-active-border-color: var(--green-800);
  --bs-btn-disabled-bg: var(--green-400);
  --bs-btn-disabled-border-color: var(--green-400);
  box-shadow: 0 3px 10px rgba(14, 122, 88, .3);
}

.btn-success {
  --bs-btn-bg: var(--green-500);
  --bs-btn-border-color: var(--green-500);
  --bs-btn-hover-bg: var(--green-600);
  --bs-btn-hover-border-color: var(--green-600);
  --bs-btn-active-bg: var(--green-700);
  --bs-btn-active-border-color: var(--green-700);
  box-shadow: 0 3px 10px rgba(18, 153, 110, .3);
}

.btn-outline-primary {
  --bs-btn-color: var(--green-600);
  --bs-btn-border-color: var(--green-400);
  --bs-btn-hover-bg: var(--green-600);
  --bs-btn-hover-border-color: var(--green-600);
  --bs-btn-active-bg: var(--green-700);
  --bs-btn-active-border-color: var(--green-700);
}

/* ---------- ฟอร์ม ---------- */
.form-control, .form-select {
  border-radius: .55rem;
  border-color: #dbe9e3;
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 .22rem rgba(46, 184, 134, .18);
}

.form-check-input:checked {
  background-color: var(--green-600);
  border-color: var(--green-600);
}

/* ---------- ตาราง ---------- */
.table thead th {
  background: var(--green-50);
  color: var(--green-900);
  font-weight: 600;
  border-bottom: 2px solid var(--green-100);
  white-space: nowrap;
}

.table-hover tbody tr {
  transition: background .12s ease;
}

.table-hover tbody tr:hover {
  background: var(--green-50);
}

.badge {
  border-radius: 50rem;
  font-weight: 500;
  padding: .38em .75em;
}

.badge.bg-primary {
  background-color: var(--green-600) !important;
}

.badge.bg-success {
  background-color: var(--green-500) !important;
}

/* ---------- ลิงก์ ---------- */
a {
  color: var(--green-600);
}

a:hover {
  color: var(--green-700);
}

/* ---------- Alert ---------- */
.alert {
  border: 0;
  border-radius: .8rem;
  box-shadow: var(--shadow-sm);
}

.alert-success {
  background: var(--green-100);
  color: var(--green-900);
  border-left: 4px solid var(--green-500);
}

/* ---------- DataTables ---------- */
div.dt-container div.dt-search input,
div.dt-container div.dt-length select {
  border-radius: .55rem;
  border-color: #dbe9e3;
}

div.dt-container .pagination .page-link {
  color: var(--green-700);
  border-radius: .5rem;
  margin: 0 2px;
  border: 0;
}

div.dt-container .pagination .active > .page-link {
  background: var(--green-600);
  color: #fff;
}

div.dt-container {
  padding: .75rem 1rem;
}

/* ---------- กระดิ่งแจ้งเตือน ---------- */
.notify-bell {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green-100);
  background: var(--green-50);
  transition: transform .15s ease, background .15s ease;
}

.notify-bell:hover {
  background: var(--green-100);
  transform: rotate(12deg) scale(1.06);
}

.notify-badge {
  font-size: .62rem;
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, .5);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
  }
}

.notify-menu {
  width: 300px;
  border: 0;
  border-radius: .9rem;
  overflow: hidden;
}

.notify-menu .dropdown-item:hover {
  background: var(--green-50);
}

/* ---------- กล่องกราฟ ---------- */
.chart-box {
  position: relative;
  height: 300px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--green-200);
  border-radius: 50rem;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green-400);
}

/* ---------- หน้า Login ---------- */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(600px 400px at 85% 15%, rgba(46, 184, 134, .25), transparent),
    radial-gradient(700px 500px at 10% 90%, rgba(14, 122, 88, .3), transparent),
    linear-gradient(160deg, var(--green-50) 0%, #ffffff 45%, var(--green-100) 100%);
}

.login-card {
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(6, 63, 48, .18);
  border: 1px solid rgba(255, 255, 255, .7);
  animation: fadeUp .5s ease both;
}

.login-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  background: linear-gradient(135deg, var(--green-500), var(--green-800));
  box-shadow: 0 8px 24px rgba(14, 122, 88, .35);
}

/* ---------- ปฏิทิน ---------- */
.calendar-table td {
  vertical-align: top;
  height: 110px;
  width: 14.28%;
  padding: .25rem;
}

.calendar-table .day-num {
  font-weight: 600;
}

.calendar-table .other-month {
  background: #f6f8f7;
  color: #aab8b2;
}

.calendar-table .today {
  background: var(--green-100);
  box-shadow: inset 0 0 0 2px var(--green-400);
}

.calendar-appt {
  display: block;
  font-size: .75rem;
  background: var(--green-100);
  border-left: 3px solid var(--green-500);
  border-radius: .3rem;
  padding: 0 .3rem;
  margin-bottom: 2px;
  text-decoration: none;
  color: var(--green-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s ease;
}

.calendar-appt:hover {
  background: var(--green-200);
}

/* ---------- พิมพ์ (ใบเสร็จ / ใบสั่งยา) ---------- */
@media print {
  body {
    background: #fff !important;
  }

  #sidebar, header, .d-print-none {
    display: none !important;
  }

  main {
    padding: 0 !important;
    background: #fff !important;
    animation: none;
  }

  .print-doc {
    box-shadow: none !important;
    border: 0 !important;
    max-width: 100% !important;
  }
}

.print-doc {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
}
