/* ==========================================================================
   Material 3 — Admin panel layout
   Navigation drawer: permanent from 1200px up, modal below.
   ========================================================================== */

:root { --md-admin-drawer-width: 280px; }

/* ---- Drawer ---- */
.m3-admin-drawer {
  width: var(--md-admin-drawer-width);
  background-color: var(--md-surface-container-low);
  background-image: linear-gradient(
    180deg,
    color-mix(in srgb, var(--md-primary-container) 45%, var(--md-surface-container-low)) 0%,
    var(--md-surface-container-low) 260px
  );
}
.m3-admin-drawer .m3-drawer-scroll {
  padding: 8px 12px;
}

.m3-admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 16px;
  margin-bottom: 4px;
  color: var(--md-on-surface);
  text-decoration: none;
  font: var(--md-title-large);
}
.m3-admin-brand:hover { text-decoration: none; }
.m3-admin-brand img { width: 32px; height: 32px; border-radius: var(--md-shape-sm); }

.m3-drawer-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

/* Expandable groups */
.m3-drawer-group { display: block; }
.m3-drawer-toggle {
  width: 100%;
  border: none;
  background: none;
  font: var(--md-label-large);
  cursor: pointer;
}
.m3-drawer-caret {
  flex: 0 0 auto;
  font-size: 20px;
  transition: transform var(--md-duration-medium) var(--md-easing-standard);
}
.m3-drawer-group.m3-open > .m3-drawer-toggle > .m3-drawer-caret { transform: rotate(180deg); }

.m3-drawer-sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--md-duration-long) var(--md-easing-emphasized);
}
.m3-drawer-group.m3-open > .m3-drawer-sub { grid-template-rows: 1fr; }
/* The single inner wrapper is what makes 0fr work: it gives the grid exactly one
   row to collapse. Without it the links become N implicit auto rows and the
   submenu never closes. It must also clip its own overflow, or the 48px links
   keep painting outside the collapsed 0px row. */
.m3-drawer-sub > .m3-drawer-sub-inner { overflow: hidden; min-height: 0; }
.m3-drawer-sub > * { overflow: hidden; }
/* The sub-list needs a wrapper row for the grid animation to collapse cleanly. */
.m3-drawer-sub { overflow: hidden; }
.m3-drawer-subitem {
  height: 48px;
  padding-left: 52px;
  font: var(--md-label-large);
}

/* ---- Main region ---- */
.m3-admin-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-inline-start var(--md-duration-long) var(--md-easing-emphasized);
}

.m3-admin-content {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
}

.m3-admin-footer {
  padding: 20px 16px;
  text-align: center;
  font: var(--md-body-small);
  color: var(--md-on-surface-variant);
  border-top: 1px solid var(--md-outline-variant);
}
.m3-admin-footer a { color: var(--md-primary); }

/* ---- Permanent drawer on large screens ---- */
@media (min-width: 1200px) {
  .m3-admin-drawer {
    transform: none;
    border-radius: 0;
    border-right: 1px solid var(--md-outline-variant);
  }
  .m3-admin-main { margin-inline-start: var(--md-admin-drawer-width); }
  .m3-admin-menu-btn { display: none; }
  .m3-drawer-scrim { display: none; }
  .m3-top-app-bar { padding-left: 16px; }
}

/* ---- Admin page furniture ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h4 { margin: 0; font: var(--md-headline-small); color: var(--md-on-surface); }

/* Stat cards on the dashboard */
.stat-card-wrap { position: relative; overflow: hidden; }
.stat-card-wrap .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--md-shape-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}
.stat-icon-primary { background: var(--md-primary-container); color: var(--md-on-primary-container); box-shadow: 0 0 14px rgba(var(--md-glow-rgb), .3); }
.stat-icon-success { background: var(--md-success-container); color: var(--md-on-success-container); }
.stat-icon-warning { background: var(--md-warning-container); color: var(--md-on-warning-container); }
.stat-icon-tertiary { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.stat-card-wrap h3 { font: var(--md-headline-medium); color: var(--md-on-surface); margin: 0 0 2px; }
.stat-label {
  font: var(--md-label-large);
  color: var(--md-on-surface-variant);
}
/* The oversized watermark icon is not Material — hide it. */
.stat-card-bg-icon { display: none; }

.notif-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--md-error);
  margin-left: 4px;
  vertical-align: middle;
}

.opacity-65 { opacity: .65; }
.opacity-75 { opacity: .75; }

/* Admin tables scroll rather than overflow the page. */
.table-responsive, .card > .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Fades at the edge hint that there is more table to the right. */
  background:
    linear-gradient(to right, var(--md-surface-container-low) 30%, transparent) left / 24px 100% no-repeat,
    linear-gradient(to left, var(--md-surface-container-low) 30%, transparent) right / 24px 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.10), transparent) left / 8px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.10), transparent) right / 8px 100% no-repeat;
  background-attachment: local, local, scroll, scroll;
}

/* The action-button cluster must stay on one line. Without this the Actions
   column collapses to a single button's width and the buttons stack into a
   tall vertical strip. The table scrolls horizontally instead. */
.table td:last-child,
.table th:last-child { white-space: nowrap; }
.table td:last-child .btn + .btn { margin-left: 4px; }

@media (max-width: 768px) {
  .m3-admin-content { padding: 16px 12px; }
  .table { font-size: 13px; }
  /* Tighter gutters so more columns fit before scrolling is needed. */
  .table > thead th { padding: 10px 12px; }
  .table > tbody td { padding: 10px 12px; }
}
