/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: "Inter", sans-serif;
  background: #f8fafc;
  color: #3b4151;
}

/* ===== Main Layout ===== */
.layout {
  display: flex;
  height: 100vh;
}

/* ===== Hamburger Toggle (hidden on desktop) ===== */
.menu-toggle-checkbox {
  display: none;
}

.menu-toggle-btn {
  display: none;
}

.sidebar-overlay {
  display: none;
}

.sidebar-close {
  display: none;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 290px;
  min-width: 290px;
  color: #fff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e2e8f0;
}

.sidebar-header {
  background-color: #fff;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 48px;
}

.sidebar-header .logo img {
  width: 160px;
  height: auto;
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #85ea2d;
  letter-spacing: 0.5px;
}

.sidebar-header p {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* ===== Sidebar Search ===== */
.sidebar-search {
  padding: 6px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  position: sticky;
  top: 48px;
  z-index: 10;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 10px center;
  outline: none;
  color: #334155;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar-search input::placeholder {
  color: #94a3b8;
}

.sidebar-search input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== Accordion Menu ===== */
.accordion-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  background-color: #fff;
}

.accordion-menu details {
  border-bottom: 1px solid #f1f5f9;
  margin: 0px 10px;
}

.accordion-menu summary {
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  user-select: none;
  border-radius: 8px;
  cursor: pointer;
}

.accordion-menu summary::-webkit-details-marker {
  display: none;
}

.accordion-menu summary::after {
  content: '';
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.accordion-menu summary.no_submenu::after {
  display: none;
}

.accordion-menu details[open]>summary::after {
  transform: rotate(90deg);
}

.accordion-menu summary:hover {
  background: #f8fafc;
  color: #295097;
}

.accordion-menu details[open]>summary {
  /* color: #295097; */
  /* background: #f0f7ff; */
}

.accordion-menu summary.no_submenu a {
  text-decoration: none;
  color: #1e293b;
  display: block;
  padding: 13px 16px;
  width: 100%;
  transition: color 0.2s;
}

.accordion-menu summary.no_submenu:hover a {
  color: #295097;
}

.accordion-menu summary.no_submenu {
  padding: 0;
}

/* ===== Category Icon Badges ===== */
.category-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 10px;
  min-width: 40px;
  text-align: center;
  text-transform: uppercase;
}

.badge-blue {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.badge-orange {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}

.badge-red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}

.badge-purple {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
}

.badge-gray {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: #fff;
}

/* ===== Sub-menu Animation ===== */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

details[open] > .sub-menu {
  animation: slideDown 0.25s ease-out;
}

/* ===== Sub-menu Links ===== */
.sub-menu {
  padding: 4px 0 8px;
}

.sub-menu a {
  display: flex;
  align-items: center;
  padding: 9px 16px 9px 20px;
  color: #475569;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s ease;
  gap: 10px;
  border-radius: 6px;
  margin: 1px 4px;
  position: relative;
}

.sub-menu a:hover {
  background: #f0f7ff;
  color: #295097;
}

/* Active sidebar link */
.sub-menu a.active,
.accordion-menu summary.no_submenu a.active {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #295097;
}

.sub-menu a .method-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  min-width: 38px;
  text-align: center;
  text-transform: uppercase;
}

.method-get {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.method-post {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
}

.method-put {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}

.method-delete {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}

.method-patch {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}

.sub-menu a .link-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Content Frame Animation ===== */
@keyframes contentFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-frame.is-loading {
  opacity: 0;
}

.content-frame.is-loaded {
  animation: contentFadeIn 0.3s ease-out forwards;
}

/* ===== Content Area ===== */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: #f8fafc;
}

.content-header {
  padding: 12px 25px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 48px;
}

.content-header a {
  text-decoration: none;
}

.content-header .ttl {
  display: flex;
  align-items: center;
  grid-gap: 8px;
}

.content-header .ttl:hover h1 {
  color: #295097;
}

.content-header .ttl:hover svg {
  stroke: #295097;
}

.content-header h1 {
  font-size: 14px;
  color: #64748b;
  font-weight: 600;
  transition: color 0.2s;
}

.content-header .breadcrumb {
  font-size: 12px;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
}

.content-frame {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  background: #f8fafc;
}

/* ===== Prev/Next Navigation Bar ===== */
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 25px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.page-nav button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #295097;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-nav button:hover {
  background: #295097;
  color: #fff;
  border-color: #295097;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(41, 80, 151, 0.25);
}

.page-nav button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
  transform: none;
  box-shadow: none;
}

.page-nav .page-title {
  font-size: 13px;
  color: #475569;
  font-weight: 600;
  text-align: center;
  flex: 1;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Sidebar Scrollbar ===== */
.sidebar::-webkit-scrollbar,
.accordion-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track,
.accordion-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.accordion-menu::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 10px;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.accordion-menu:hover::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.accordion-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
  padding: 12px 20px;
  background: #252525;
  border-top: 1px solid #333;
  font-size: 11px;
  color: #666;
  text-align: center;
}

/* ===== Keyboard Shortcut Hint ===== */
.keyboard-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 11px;
  color: #94a3b8;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 10px;
  font-family: inherit;
  color: #6b7280;
  box-shadow: 0 1px 0 #d1d5db;
}

/* ============================================
   RESPONSIVE - Tablet (max-width: 992px)
   ============================================ */
@media (max-width: 992px) {
  .sidebar {
    width: 250px;
    min-width: 250px;
  }

  .content-header {
    padding: 12px 18px;
  }

  .keyboard-hint {
    display: none;
  }
}

/* ============================================
   RESPONSIVE - Mobile (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

  /* Show hamburger button */
  .menu-toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    position: fixed;
    top: 6px;
    left: 8px;
    z-index: 1000;
    width: 36px;
    height: 36px;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    transition: background 0.2s;
  }

  .menu-toggle-btn:hover {
    background: #dbeafe;
  }

  .hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: #295097;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
  }

  /* Hamburger to X animation when checked */
  .menu-toggle-checkbox:checked~.menu-toggle-btn .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-toggle-checkbox:checked~.menu-toggle-btn .hamburger-line:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle-checkbox:checked~.menu-toggle-btn .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Sidebar - off-screen by default */
  .sidebar {
    position: fixed;
    top: 0;
    left: -290px;
    width: 290px;
    min-width: 290px;
    height: 100vh;
    z-index: 999;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  /* Slide in when checkbox is checked */
  .menu-toggle-checkbox:checked~.layout .sidebar {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  /* Dark overlay behind sidebar */
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    cursor: pointer;
    backdrop-filter: blur(2px);
  }

  .menu-toggle-checkbox:checked~.sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }

  /* Close X button inside sidebar header */
  .sidebar-close {
    display: block;
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 26px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
  }

  .sidebar-close:hover {
    color: #ef4444;
  }

  /* Content takes full width */
  .content {
    width: 100%;
  }

  .page-nav {
    padding: 8px 15px;
  }

  .page-nav button {
    padding: 5px 10px;
    font-size: 12px;
  }

  .page-nav .page-title {
    font-size: 12px;
  }

  /* Adjust header for mobile - leave space for hamburger */
  .content-header {
    padding: 12px 15px 12px 54px;
    flex-wrap: wrap;
    gap: 4px;
  }

  .keyboard-hint {
    display: none;
  }
}

/* ============================================
   RESPONSIVE - Small Mobile (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
  .sidebar {
    width: 270px;
    min-width: 270px;
    left: -270px;
  }

  .content-header {
    padding: 10px 12px 10px 54px;
  }

  .accordion-menu summary {
    padding: 12px 14px;
    font-size: 12px;
  }

  .sub-menu a {
    padding: 9px 14px 9px 18px;
    font-size: 12px;
  }
}
