@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@200&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary:        #0b3d91;
  --primary-dark:   #071f4f;
  --primary-light:  #1a5cb8;
  --teal:           #00b4d8;
  --teal-light:     #98d9f3;
  --gold:           #f5a623;
  --gold-light:     #ffce6b;
  --success:        #28a745;
  --warning:        #ffc107;
  --danger:         #dc3545;
  --info:           #17a2b8;
  --bg:             #ffffff;       /* ← พื้นหลังขาว */
  --bg-subtle:      #f8f9fa;       /* ← สำหรับ hover / zebra */
  --bg-white:       #ffffff;
  --bg-disable:     #dee2e6;
  --text:           #1e2a3b;
  --text-muted:     #6b7c93;
  --border:         #dce3ef;
  --radius:         10px;
  --radius-lg:      16px;
  --shadow-sm:      0 2px 8px rgba(11,61,145,.07);
  --shadow-md:      0 4px 20px rgba(11,61,145,.12);
  --shadow-lg:      0 8px 32px rgba(11,61,145,.16);
  --header-h:       62px;
  --transition:     .2s ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Prompt', 'Segoe UI', sans-serif;
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--teal); }
img { max-width: 100%; height: auto; }

/* ── Page Wrapper ───────────────────────────────────────────── */
#page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   TOP NAVIGATION BAR  —  สีขาว + ขอบล่าง
   Bootstrap classes ที่ใช้ร่วม: .navbar .navbar-expand-lg .sticky-top
   ============================================================ */
.navbar,
nav.navbar {
  background: #ffffff !important;
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 10px rgba(11,61,145,.08);
  min-height: var(--header-h);
  padding: 0 24px;
  top: 0;
  z-index: 1030;
}

/* Brand / Logo */
.navbar-brand,
.navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #646464 !important;
  font-size: 1.5rem;
  letter-spacing: .3px;
  text-decoration: none;
}

.navbar-brand .brand-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
}

.navbar-brand img {
  width: 34px; height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

/* Nav Links */
.navbar-nav .nav-link,
.navbar-nav > li > a {
  color: var(--text-muted) !important;
  font-size: .88rem;
  font-weight: 500;
  padding: 13px 13px 0 !important;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.navbar-nav .nav-link:hover,
.navbar-nav > li > a:hover {
  background: var(--bg-subtle);
  color: var(--primary) !important;
}

.navbar-nav .nav-link.active,
.navbar-nav > li.active > a {
  color: var(--primary) !important;
  font-weight: 600;
}

/* Active underline */
.navbar-nav .nav-link.active::after {
  content: '';
  display: block;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  margin-top: 2px;
}

/* Dropdown */
.navbar-nav .dropdown-menu {
  background: var(--bg-white);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  margin-top: 6px;
}

.navbar-nav .dropdown-item {
  border-radius: 6px;
  padding: 8px 14px;
  font-size: .86rem;
  color: var(--text);
  transition: background var(--transition);
}

.navbar-nav .dropdown-item:hover { background: var(--bg-subtle); color: var(--primary); }
.navbar-nav .dropdown-item.active,
.navbar-nav .dropdown-item:active { background: var(--primary); color: #fff; }

/* Dropdown caret */
.navbar-nav .dropdown-toggle::after {
  border-top-color: var(--text-muted);
  vertical-align: .18em;
  border-top-width: .35em;
  border-right-width: .35em;
  border-left-width: .35em;
}

/* ── Hover Dropdown (desktop only) ────────────────────────── */
@media (min-width: 1200px) {
  /* แสดง dropdown ทันทีเมื่อ hover */
  .navbar-nav .dropdown:hover > .dropdown-menu {
    display: block;
    margin-top: 0;
    animation: dropFadeIn .15s ease;
  }
 
  /* ป้องกัน gap ระหว่าง toggle กับ menu */
  .navbar-nav .dropdown-menu {
    margin-top: 0 !important;
    padding-top: 4px;
  }
}
 
@keyframes dropFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Search Bar */
.navbar .navbar-search {
  position: relative;
  min-width: 260px;
}

.navbar .navbar-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .85rem;
  pointer-events: none;
}

.navbar .navbar-search .form-control {
  background: var(--bg-subtle) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 20px !important;
  color: var(--text) !important;
  padding: 6px 16px 6px 36px !important;
  font-size: .85rem;
}

.navbar .navbar-search .form-control::placeholder { color: var(--text-muted); }

.navbar .navbar-search .form-control:focus {
  border-color: var(--teal) !important;
  box-shadow: 0 0 0 3px rgba(0,180,216,.12) !important;
  background: #fff !important;
}

/* Navbar Divider */
.navbar-divider {
  width: 1px; height: 24px;
  background: var(--border);
  margin: 0 8px;
  flex-shrink: 0;
}

/* Icon Buttons (bell, settings) */
.navbar-icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  position: relative;
  text-decoration: none;
}

.navbar-icon-btn:hover { background: var(--bg-subtle); color: var(--primary); }

.navbar-icon-btn .badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  font-size: .6rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* User Avatar */
.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 8px;
  transition: background var(--transition);
  color: var(--text);
}

.navbar-user:hover { background: var(--bg-subtle); }

.navbar-user .avatar,
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
  object-fit: cover;
}

.navbar-user .user-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.navbar-user .user-role {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1;
}

/* Hamburger Toggler */
.navbar-toggler {
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 6px 10px;
}

.navbar-toggler:focus { box-shadow: none !important; }

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%230b3d91' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* ============================================================
   SECONDARY TOPBAR  (optional breadcrumb + actions row)
   ============================================================ */
.topbar-secondary {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* main layout  */
main > .container-fluid {
    padding-top: calc(var(--header-h) + 16px);
}

/* ── 3-COLUMN LAYOUT ── */
.layout-3col {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  grid-template-areas: "profile main calendar";
  gap: 20px;
  align-items: start;
}

.col-profile  { grid-area: profile; }
.col-main     { grid-area: main; }
.col-calendar { grid-area: calendar; }

.col-profile,
.col-calendar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.col-main a {
  color: #545c64;
  font-weight: 100;
}

/* ── Profile Card ── */
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--text-muted);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700;
  border: 3px solid var(--border);
}

.profile-avatar img {
  width:100%; height:100%; border-radius:50%; object-fit:cover; object-position: top;
}

.profile-stats {
  display: flex;
  border-top: 1px solid var(--border);
}

.profile-stat-item {
  flex: 1; text-align: center;
  padding: 12px 6px;
  border-right: 1px solid var(--border);
}
.profile-stat-item:last-child { border-right: none; }
.profile-stat-item .stat-num  { font-size: 1.2rem; font-weight: 700; color: var(--primary-dark); line-height: 1; }
.profile-stat-item .stat-lbl  { font-size: .68rem; color: var(--text-muted); margin-top: 2px; }

/* ── Sidebar Link List ── */
.sidebar-link-list { list-style: none; padding: 0; margin: 0; }
.sidebar-link-list li { margin-bottom: 1px; }

.sll-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 7px;
  font-size: .85rem; font-weight: 500;
  color: var(--text) !important;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.sll-item:hover { background: var(--bg-subtle); color: var(--primary) !important; }

/* ── Google Calendar iframe ── */
.gcal-iframe {
  width: 100%; height: 420px;
  border: none; border-radius: var(--radius); display: block;
}

/* ── Responsive ── */
@media (max-width: 1280px) {
  .layout-3col { grid-template-columns: 210px 1fr 260px; gap: 16px; }
}

@media (max-width: 1024px) {
  .layout-3col {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "calendar" "profile";
  }
  .col-profile, .col-calendar { position: static; max-height: none; }
  .gcal-iframe { height: 320px; }
}

/* @media (max-width: 1024px) {
  .layout-3col {
    grid-template-columns: 1fr 260px;
    grid-template-areas: "main calendar" "profile calendar";
  }
} */

/* @media (max-width: 768px) {
  .layout-3col {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "calendar" "profile";
  }
  .col-profile, .col-calendar { position: static; max-height: none; }
  .gcal-iframe { height: 320px; }
} */

/* ============================================================
   MAIN CONTENT AREA  (ไม่มี sidebar margin)
   ============================================================ */
#content,
.main-content {
  flex: 1;
  width: 100%;
}

.page-container {
  margin: 0 auto;
}

/* ============================================================
   QUICK LINKS
   ============================================================ */
.quick-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.quick-link-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform var(--transition);
  text-decoration: none;
}

.quick-link-item:hover { transform: translateY(-3px); }

.quick-link-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-md);
  transition: background var(--transition);
}

.quick-link-item:hover .quick-link-icon { background: var(--teal); }

.quick-link-item span {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
}

/* ============================================================
   CARDS  (Bootstrap .card override)
   ============================================================ */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card-header {
  background: var(--bg-white) !important;
  border-bottom: 1.5px solid var(--border) !important;
  padding: 14px 20px;
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header.gold  { background: var(--gold-light) !important; color: var(--primary-dark); border: none !important; }
.card-header.teal  { background: var(--teal-light) !important; color: var(--primary-dark); border: none !important; }
.card-header.navy  { background: var(--primary) !important; color: #fff; border: none !important; }

.card-body { padding: 20px; }

.card-footer {
  background: var(--bg-subtle) !important;
  border-top: 1px solid var(--border) !important;
  padding: 12px 20px;
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary) !important;
  transition: box-shadow var(--transition), transform var(--transition);
  height: 100%;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card.gold  { border-left-color: var(--gold) !important; }
.stat-card.teal  { border-left-color: var(--teal) !important; }
.stat-card.green { border-left-color: var(--success) !important; }
.stat-card.red   { border-left-color: var(--danger) !important; }

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card.gold  .stat-icon { background: var(--gold); }
.stat-card.teal  .stat-icon { background: var(--teal); }
.stat-card.green .stat-icon { background: var(--success); }
.stat-card.red   .stat-icon { background: var(--danger); }

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.btn-add-task {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--primary-light);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  transition: color var(--transition);
  font-family: inherit;
}
.btn-add-task:hover { color: var(--teal); }

/* ── Event List ─────────────────────────────────────────────── */
.event-list { list-style: none; padding: 0; margin: 12px 0 0; }

.event-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .83rem;
}

.event-list li:last-child { border-bottom: none; }

.event-date { min-width: 36px; text-align: center; }
.event-date .day { font-size: 1.1rem; font-weight: 700; color: var(--primary); line-height: 1; }
.event-date .month { font-size: .7rem; text-transform: uppercase; color: var(--text-muted); }

.event-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .7rem;
  font-weight: 600;
  margin-top: 2px;
}

.event-tag.hr-tech { background: #cce5ff; color: #004085; }
.event-tag.meeting { background: #d4edda; color: #155724; }
.event-tag.fun     { background: #fff3cd; color: #856404; }

/* ============================================================
   ALERTS  (Bootstrap override)
   ============================================================ */
.alert {
  border: none !important;
  border-radius: var(--radius) !important;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #d4edda !important; color: #155724 !important; }
.alert-info    { background: #cce5ff !important; color: #004085 !important; }
.alert-warning { background: #fff3cd !important; color: #856404 !important; }
.alert-danger  { background: #f8d7da !important; color: #721c24 !important; }

/* ============================================================
   BUTTONS  (Bootstrap override)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px !important;
  font-size: .88rem;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition) !important;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(11,61,145,.25);
}
.btn-primary:hover {
  background: var(--primary-light) !important;
  border-color: var(--primary-light) !important;
  box-shadow: var(--shadow-md);
}

.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.btn-outline-primary:hover { background: var(--primary) !important; color: #fff !important; }

.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(245,166,35,.28);
}
.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); }

.btn-teal {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,180,216,.25);
}
.btn-teal:hover { background: var(--teal-light); border-color: var(--teal-light); }

/* ============================================================
   FORMS  (Yii2 ActiveForm + Bootstrap)
   ============================================================ */
.form-control,
.form-select {
  border: 1.5px solid var(--border) !important;
  border-radius: 20px !important;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg-white) !important;
  transition: border-color var(--transition), box-shadow var(--transition) !important;
  font-family: inherit;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--teal) !important;
  box-shadow: 0 0 0 3px rgba(0,180,216,.14) !important;
  outline: none;
}

.form-control:read-only,
.form-select:read-only {
  background-color: var(--bg-disable) !important;
}

.form-label,
label,
.control-label {
  /* font-size: .84rem; */
  /* font-weight: 600; */
  color: var(--text);
  margin-bottom: 5px;
}

.form-group { margin-bottom: 18px; }

.has-error .form-control   { border-color: var(--danger) !important; }
.has-success .form-control { border-color: var(--success) !important; }

.help-block,
.form-text {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.has-error .help-block { color: var(--danger); }

.input-group .input-group-text {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

/* ============================================================
   FOOTER
   ============================================================ */
footer.footer,
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.5);
  padding: 16px 28px;
  font-size: .78rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.site-footer a { color: var(--teal-light); }
.site-footer a:hover { color: #fff; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-primary  { color: var(--primary) !important; }
.text-teal     { color: var(--teal) !important; }
.text-gold     { color: var(--gold) !important; }
.text-navy     { color: var(--primary-dark) !important; }
.text-cyan     { color:#4490b7}

.bg-primary-custom { background: var(--primary) !important; color: #fff; }
.bg-teal-custom    { background: var(--teal) !important; color: #fff; }
.bg-gold-custom    { background: var(--gold) !important; color: var(--primary-dark); }
.bg-subtle         { background: var(--bg-subtle) !important; }

.rounded-custom    { border-radius: var(--radius) !important; }
.rounded-lg-custom { border-radius: var(--radius-lg) !important; }
.shadow-custom-sm  { box-shadow: var(--shadow-sm) !important; }
.shadow-custom-md  { box-shadow: var(--shadow-md) !important; }

.section-gap  { margin-bottom: 28px; }
.border-custom { border: 1px solid var(--border) !important; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet — hamburger menu */
@media (max-width: 992px) {
  .navbar-collapse {
    background: #fff;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 10px 0;
    box-shadow: var(--shadow-md);
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    z-index: 1029;
  }

  .navbar-nav .nav-link {
    padding: 8px 18px !important;
    border-radius: 6px;
    margin: 1px;
  }

  .navbar-nav .nav-link.active::after { display: none; }
  .navbar-nav .nav-link.active { background: var(--bg-subtle); }

  .navbar .navbar-search { min-width: unset; width: calc(100% - 20px); margin: 6px 10px; }

  .page-container { padding: 20px 16px 40px; }
}

/* Mobile */
@media (max-width: 768px) {
  .quick-links { gap: 12px; }
  .quick-link-icon { width: 48px; height: 48px; font-size: 1.1rem; }
  .quick-link-item span { font-size: .7rem; }
  .stat-card .stat-value { font-size: 1.35rem; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
  footer.footer, .site-footer { flex-direction: column; text-align: center; }
}

/* Small mobile */
@media (max-width: 480px) {
  .navbar { padding: 0 12px; }
  .page-container { padding: 14px 12px 32px; }
}

/* เพิ่มต่อท้าย CSS ได้เลยค่ะ */
@media (min-width: 1280px) {
  .col-main {
    margin: 50px;
  }
}