/* ============================================================
 * Custom styles for HTML5 Dashboard Template (CoreUI-inspired)
 * Built on Bootstrap 5.3.8
 * ============================================================ */

:root {
  --sidebar-width: 256px;
  --sidebar-narrow-width: 56px;
  --header-height: 56px;
  --sidebar-bg: #3c4b64;
  --sidebar-color: rgba(255, 255, 255, 0.8);
  --sidebar-color-hover: #fff;
  --sidebar-active-bg: rgba(255, 255, 255, 0.05);
  --sidebar-active-color: #fff;
  --sidebar-title-color: rgba(255, 255, 255, 0.6);
  --sidebar-border: rgba(255, 255, 255, 0.075);
}

[data-bs-theme="dark"] {
  --sidebar-bg: #1f2330;
}

html, body {
  height: 100%;
}

body {
  background-color: #ebedef;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 0.875rem;
  min-height: 100vh;
}

[data-bs-theme="dark"] body {
  background-color: #15171e;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-color);
  display: flex;
  flex-direction: column;
  z-index: 1031;
  transition: margin-left 0.25s ease-in-out, width 0.25s ease-in-out;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--header-height);
  background-color: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.sidebar-brand:hover { color: #fff; }

.sidebar-brand .brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav .nav-title {
  padding: 0.75rem 1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--sidebar-title-color);
  letter-spacing: 0.05em;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  color: var(--sidebar-color);
  text-decoration: none;
  transition: background-color 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
  color: var(--sidebar-color-hover);
  background-color: var(--sidebar-active-bg);
}

.sidebar-nav .nav-link.active {
  color: var(--sidebar-active-color);
  background-color: var(--sidebar-active-bg);
  border-left-color: #321fdb;
}

.sidebar-nav .nav-link i {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-group .nav-link.nav-group-toggle::after {
  content: "\F282"; /* bi-chevron-right */
  font-family: "bootstrap-icons";
  margin-left: auto;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.sidebar-nav .nav-group.open > .nav-link.nav-group-toggle::after {
  transform: rotate(90deg);
}

.sidebar-nav .nav-group-items {
  display: none;
  background-color: rgba(0, 0, 0, 0.15);
}

.sidebar-nav .nav-group.open > .nav-group-items {
  display: block;
}

.sidebar-nav .nav-group-items .nav-link {
  padding-left: 3rem;
  font-size: 0.85rem;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 0.625rem 1rem;
  font-size: 0.8rem;
}

.sidebar-toggler {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 0;
  width: 100%;
  color: var(--sidebar-color);
  cursor: pointer;
}

.sidebar-toggler:hover { color: #fff; }

/* Sidebar collapsed (desktop) */
.sidebar.sidebar-narrow-unfoldable {
  width: var(--sidebar-narrow-width);
}

.sidebar.sidebar-narrow-unfoldable .sidebar-brand span,
.sidebar.sidebar-narrow-unfoldable .nav-link span,
.sidebar.sidebar-narrow-unfoldable .nav-link .badge,
.sidebar.sidebar-narrow-unfoldable .nav-title,
.sidebar.sidebar-narrow-unfoldable .nav-link.nav-group-toggle::after {
  display: none;
}

.sidebar.sidebar-narrow-unfoldable .nav-link {
  justify-content: center;
}

/* API status badge — narrow mode: chỉ hiện dot, ẩn text */
.sidebar.sidebar-narrow-unfoldable .sidebar-footer {
  padding: 0.625rem 0;
}
.sidebar.sidebar-narrow-unfoldable #api-status-badge {
  justify-content: center;
  gap: 0;
  overflow: hidden;
}
.sidebar.sidebar-narrow-unfoldable #api-status-badge .status-text {
  display: none;
}

/* Sidebar hidden on mobile */
@media (max-width: 991.98px) {
  .sidebar {
    margin-left: calc(-1 * var(--sidebar-width));
  }
  .sidebar.show {
    margin-left: 0;
  }
}

/* Sidebar overlay (mobile) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1030;
  display: none;
}

.sidebar-backdrop.show { display: block; }

/* ===== Wrapper / Main content ===== */
.wrapper {
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease-in-out;
}

.wrapper.sidebar-narrow {
  margin-left: var(--sidebar-narrow-width);
}

@media (max-width: 991.98px) {
  .wrapper { margin-left: 0; }
  .wrapper.sidebar-narrow { margin-left: 0; }
}

/* ===== Header ===== */
.header {
  background-color: #fff;
  border-bottom: 1px solid #d8dbe0;
  min-height: var(--header-height);
}

[data-bs-theme="dark"] .header {
  background-color: #21252e;
  border-bottom-color: #303440;
}

.header .header-navbar {
  min-height: var(--header-height);
}

.header-toggler {
  background: transparent;
  border: 0;
  padding: 0.5rem 0.75rem;
  font-size: 1.25rem;
  color: #4f5d73;
}

[data-bs-theme="dark"] .header-toggler { color: #a3a8b1; }

.header-brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: #321fdb;
  text-decoration: none;
  margin-right: 1rem;
}

.header-nav .nav-link {
  color: #4f5d73;
  padding: 0.5rem 0.75rem;
}

[data-bs-theme="dark"] .header-nav .nav-link { color: #a3a8b1; }

.header-nav .nav-link:hover { color: #321fdb; }

.header-divider {
  border-top: 1px solid #d8dbe0;
  margin: 0 -1rem;
}

[data-bs-theme="dark"] .header-divider { border-top-color: #303440; }

/* Breadcrumb in header — match CoreUI sample (no blue links) */
.header .breadcrumb {
  --bs-breadcrumb-divider-color: #8a93a2;
  --bs-breadcrumb-item-active-color: #768192;
  --bs-breadcrumb-item-padding-x: 0.5rem;
  margin-bottom: 0;
  background-color: transparent;
  padding: 0.5rem 0;
  font-size: 1rem;
  font-weight: 400;
}

.header .breadcrumb-item a {
  color: #4f5d73;
  text-decoration: none;
}

.header .breadcrumb-item a:hover {
  color: #2c384a;
  text-decoration: none;
}

.header .breadcrumb-item.active { color: #768192; }

[data-bs-theme="dark"] .header .breadcrumb-item a { color: #c4c9d0; }
[data-bs-theme="dark"] .header .breadcrumb-item a:hover { color: #fff; }
[data-bs-theme="dark"] .header .breadcrumb-item.active { color: #8a93a2; }

/* ===== Body / Footer ===== */
.body {
  flex: 1 0 auto;
  padding: 1.5rem 0;
}

.footer {
  background-color: #fff;
  border-top: 1px solid #d8dbe0;
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  color: #5c6873;
}

[data-bs-theme="dark"] .footer {
  background-color: #21252e;
  border-top-color: #303440;
  color: #a3a8b1;
}

/* ===== Avatars ===== */
.avatar {
  position: relative;
  display: inline-block;
}

.avatar-md {
  width: 40px;
  height: 40px;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ===== Progress thin ===== */
.progress-thin {
  height: 4px;
}

/* ===== Cards: colored stats ===== */
.card-stats { border: 0; }

.card-stats .stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.card-stats .stat-change {
  font-size: 0.875rem;
  font-weight: 400;
  margin-left: 0.5rem;
}

.card-stats .stat-chart {
  height: 70px;
  margin: 1rem 1rem 0;
  position: relative;
}

.card-stats .stat-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Sales card border accents */
.border-accent {
  border-left: 4px solid;
  padding-left: 0.75rem;
}

/* ===== Pokemon type label ===== */
.pokemon-type {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
}

.pokemon-type-normal   { background-color: #a8a878; }
.pokemon-type-fire     { background-color: #f08030; }
.pokemon-type-water    { background-color: #6890f0; }
.pokemon-type-electric { background-color: #f8d030; color: #333; }
.pokemon-type-grass    { background-color: #78c850; }
.pokemon-type-ice      { background-color: #98d8d8; color: #333; }
.pokemon-type-fighting { background-color: #c03028; }
.pokemon-type-poison   { background-color: #a040a0; }
.pokemon-type-ground   { background-color: #e0c068; color: #333; }
.pokemon-type-flying   { background-color: #a890f0; }
.pokemon-type-psychic  { background-color: #f85888; }
.pokemon-type-bug      { background-color: #a8b820; }
.pokemon-type-rock     { background-color: #b8a038; }
.pokemon-type-ghost    { background-color: #705898; }
.pokemon-type-dragon   { background-color: #7038f8; }
.pokemon-type-dark     { background-color: #705848; }
.pokemon-type-steel    { background-color: #b8b8d0; color: #333; }
.pokemon-type-fairy    { background-color: #ee99ac; }

/* Sortable column header */
.th-sort {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.th-sort::after {
  content: "\F574"; /* bi-arrow-down-up */
  font-family: "bootstrap-icons";
  font-size: 0.75rem;
  opacity: 0.4;
}

.th-sort.sort-asc::after  { content: "\F148"; opacity: 1; } /* bi-arrow-up */
.th-sort.sort-desc::after { content: "\F128"; opacity: 1; } /* bi-arrow-down */

/* ===== Auth page ===== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background-color: #ebedef;
}

[data-bs-theme="dark"] .auth-wrapper { background-color: #15171e; }

.auth-card {
  background-color: #fff;
  border: 1px solid #d8dbe0;
}

[data-bs-theme="dark"] .auth-card {
  background-color: #21252e;
  border-color: #303440;
}

.auth-aside {
  background-color: #321fdb;
  color: #fff;
}

/* ===== Misc ===== */
.text-muted-sm { color: rgba(44, 56, 74, 0.681); }
[data-bs-theme="dark"] .text-muted-sm { color: #a3a8b1; }

.cursor-pointer { cursor: pointer; }
