/* ============================================================
   layout.css — Structural Layout
   ============================================================ */

/* ---- NAVBAR ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 24px;
  z-index: 1000;
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-logo {
  width: 44px;
  height: 44px;
  background: var(--grad-green-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(45,138,92,0.3);
}

.navbar-title {
  display: flex;
  flex-direction: column;
}

.navbar-title-main {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.navbar-title-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-contact {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.navbar-contact i { color: var(--green-400); }

.navbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.navbar-fb-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.navbar-fb-link:hover {
  background: var(--green-50);
  border-color: var(--green-300);
  color: var(--green-500);
}
.navbar-fb-link i { color: #1877f2; font-size: 15px; }

.theme-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.theme-btn:hover {
  background: var(--green-50);
  border-color: var(--green-300);
  color: var(--green-500);
}

.hamburger-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.hamburger-btn:hover {
  background: var(--green-50);
  border-color: var(--green-300);
  color: var(--green-500);
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--navbar-h));
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  transition: transform var(--transition-slow), background var(--transition-slow);
  padding-bottom: 24px;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--green-200); border-radius: 2px; }

.sidebar-section {
  padding: 8px 0 0;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  padding: 6px 14px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* สีแต่ละหมวด */
.sidebar-section:nth-child(1) .sidebar-section-title { background: #1b5e20; }
.sidebar-section:nth-child(2) .sidebar-section-title { background: #1565c0; }
.sidebar-section:nth-child(3) .sidebar-section-title { background: #e65100; }
.sidebar-section:nth-child(4) .sidebar-section-title { background: #6a1b9a; }
.sidebar-section:nth-child(5) .sidebar-section-title { background: #00695c; }

/* สี icon ตามหมวด */
.sidebar-section:nth-child(1) .sidebar-item i { color: #2e7d32; }
.sidebar-section:nth-child(2) .sidebar-item i { color: #1565c0; }
.sidebar-section:nth-child(3) .sidebar-item i { color: #e65100; }
.sidebar-section:nth-child(4) .sidebar-item i { color: #6a1b9a; }
.sidebar-section:nth-child(5) .sidebar-item i { color: #00695c; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
}

.sidebar-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.sidebar-item:hover,
.sidebar-item.active {
  background: var(--green-50);
  color: var(--green-500);
}
.sidebar-item:hover i,
.sidebar-item.active i {
  color: var(--green-400);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--green-400);
  border-radius: 0 2px 2px 0;
}

.sidebar-chevron {
  margin-left: auto;
  font-size: 11px;
  transition: transform var(--transition);
}
.sidebar-item.open .sidebar-chevron { transform: rotate(90deg); }

.sidebar-submenu {
  display: none;
  background: var(--green-50);
  border-left: 2px solid var(--green-200);
  margin-left: 28px;
  margin-right: 12px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.sidebar-submenu.open { display: block; }

.sidebar-submenu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.sidebar-submenu a::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green-300);
  flex-shrink: 0;
}
.sidebar-submenu a:hover { color: var(--green-500); }

/* ---- OVERLAY (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 850;
}
.sidebar-overlay.active { display: block; }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: 28px 32px;
}

/* ---- FOOTER ---- */
.footer {
  background: var(--green-600);
  color: rgba(255,255,255,0.9);
  padding: 28px 32px;
  margin-left: 0;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 100%;
}

.footer-brand { display: flex; flex-direction: column; gap: 6px; }
.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.footer-logo-circle {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.footer-name { font-size: 15px; font-weight: 700; color: #fff; }
.footer-address { font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.6; }

.footer-contact { display: flex; flex-direction: column; gap: 8px; }
.footer-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}
.footer-contact-item i { width: 16px; color: var(--green-200); }
.footer-contact-item a { color: rgba(255,255,255,0.85); }
.footer-contact-item a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 20px;
  padding-top: 16px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.page-header-icon {
  width: 44px;
  height: 44px;
  background: var(--green-100);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-500);
  font-size: 20px;
  flex-shrink: 0;
}
.page-header-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-header-text p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
