/* ==========================================================
   ADMIN APPLICATION LAYOUT
========================================================== */

.admin-area {
  min-height: calc(100vh - 76px);
  padding: 24px 0 40px;
  background: #f6f7f9;
}

.admin-area > .container-fluid {
  padding-right: 24px;
  padding-left: 24px;
}

.admin-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  min-height: calc(100vh - 124px);
}

.admin-area > .container-fluid > .row {
  align-items: flex-start;
}

.admin-area > .container-fluid > .row > div:has(> .admin-sidebar) {
  width: 240px;
  max-width: 240px;
  flex: 0 0 240px;
}

.admin-area > .container-fluid > .row > div:not(:has(> .admin-sidebar)) {
  min-width: 0;
  max-width: none;
  width: auto;
  flex: 1 1 0;
}

.admin-sidebar-column {
  width: 240px;
  flex: 0 0 240px;
}

.admin-main {
  min-width: 0;
  flex: 1;
}

.admin-sidebar {
  position: sticky;
  top: 88px;
  height: calc(100vh - 112px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.admin-sidebar-brand > div:nth-child(2) {
  display: flex;
  flex-direction: column;
}

.admin-sidebar-brand small {
  color: var(--muted);
}

.admin-sidebar .sidebar-toggle {
  display: none;
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 0;
  border-radius: 10px;
  background: #fff1f3;
  color: var(--primary-dark);
  font-size: 20px;
}

.admin-sidebar-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff1f3;
  color: var(--primary-dark);
  font-size: 22px;
}

.admin-menu {
  display: flex;
  min-height: calc(100% - 85px);
  flex-direction: column;
  padding: 10px;
}

.admin-menu a {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.admin-menu a:hover {
  background: #fff6f7;
  color: var(--primary);
}

.admin-menu a.active {
  background: #fff1f3;
  color: var(--primary-dark);
  font-weight: 600;
}

.admin-menu-logout {
  margin-top: auto;
  color: #a02b37 !important;
}

.admin-page-header {
  margin-bottom: 24px;
}

.admin-page-header h1 {
  margin-bottom: 5px;
  font-size: 30px;
  font-weight: 700;
}

.admin-page-header p {
  margin: 0;
  color: var(--muted);
}

.admin-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.permission-card {
  max-width: 1080px;
}

.permission-matrix th:first-child,
.permission-matrix td:first-child {
  min-width: 220px;
}

.permission-toggle {
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
}

@media (max-width: 991.98px) {
  .admin-area > .container-fluid {
    padding-right: 16px;
    padding-left: 16px;
  }

  .admin-layout {
    flex-direction: column;
    gap: 14px;
  }

  .admin-area > .container-fluid > .row {
    flex-direction: column;
    gap: 14px;
  }

  .admin-area > .container-fluid > .row > div:has(> .admin-sidebar),
  .admin-area > .container-fluid > .row > div:not(:has(> .admin-sidebar)) {
    width: 100%;
    max-width: none;
    flex-basis: auto;
  }

  .admin-sidebar-column {
    width: 100%;
    flex-basis: auto;
  }

  .admin-sidebar {
    position: relative;
    top: auto;
    height: auto;
    overflow: visible;
  }

  .admin-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    display: none;
    min-height: 0;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 16px 36px rgba(40, 20, 25, 0.14);
  }

  .admin-sidebar.is-open .admin-menu {
    display: flex;
  }

  .admin-sidebar .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 575.98px) {
  .admin-card {
    padding: 18px;
  }
}
