/* =========================================================
   WIRTZ MAYORISTA · ADMINISTRACIÓN
   ========================================================= */

:root {
  --admin-bg: #f5f5f5;
  --admin-surface: #ffffff;
  --admin-surface-soft: #fafafa;
  --admin-sidebar: #151515;
  --admin-sidebar-soft: #1d1d1d;

  --admin-text: #111111;
  --admin-text-soft: #5f5f5f;
  --admin-text-muted: #909090;

  --admin-light: #ffffff;
  --admin-light-soft: rgba(255, 255, 255, 0.68);
  --admin-light-muted: rgba(255, 255, 255, 0.42);

  --admin-line: #dddddd;
  --admin-line-soft: #ececec;
  --admin-line-dark: rgba(255, 255, 255, 0.1);

  --admin-accent: #e51d2a;
  --admin-accent-soft: rgba(229, 29, 42, 0.09);

  --admin-success: #176a3a;
  --admin-warning: #9b6200;
  --admin-danger: #c71d28;

  --admin-sidebar-width: 250px;
  --admin-topbar-height: 72px;

  --admin-radius-sm: 8px;
  --admin-radius-md: 12px;
  --admin-radius-lg: 16px;

  --admin-shadow:
    0 16px 40px rgba(0, 0, 0, 0.07);

  --admin-transition:
    160ms ease;
}

/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--admin-bg);
}

body {
  min-height: 100vh;
  margin: 0;

  font-family:
    "DM Sans",
    Arial,
    sans-serif;

  background: var(--admin-bg);
  color: var(--admin-text);

  -webkit-font-smoothing:
    antialiased;
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* =========================================================
   APP
   ========================================================= */

.admin-app {
  min-height: 100vh;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.admin-sidebar {
  position: fixed;
  inset:
    0
    auto
    0
    0;

  z-index: 100;

  width: var(--admin-sidebar-width);

  display: flex;
  flex-direction: column;

  background: var(--admin-sidebar);
  color: var(--admin-light);

  border-right: 1px solid var(--admin-line-dark);

  transition:
    transform var(--admin-transition);
}

.admin-sidebar-header {
  min-height: var(--admin-topbar-height);
  padding: 14px 18px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  border-bottom: 1px solid var(--admin-line-dark);
}

.admin-brand {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-brand-logo {
  width: 72px;
  height: 36px;

  flex: 0 0 auto;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  border-radius: 5px;

  background: #ffffff;
  color: #111111;
}

.admin-brand-logo span {
  font-size: 14px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.8px;
}

.admin-brand-logo small {
  margin-top: 1px;

  font-size: 5px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.admin-brand-copy {
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-brand-copy strong {
  font-size: 12px;
  font-weight: 800;
}

.admin-brand-copy span {
  font-size: 10px;
  color: var(--admin-light-muted);
}

.admin-sidebar-close {
  display: none !important;
}

.admin-sidebar-content {
  min-height: 0;
  flex: 1;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 18px 12px;
}

.admin-navigation {
  display: grid;
  gap: 22px;
}

.admin-navigation-group {
  display: grid;
  gap: 5px;
}

.admin-navigation-label {
  padding: 0 10px 7px;

  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;

  color: var(--admin-light-muted);
}

.admin-navigation-link {
  min-height: 42px;
  padding: 0 11px;

  display: flex;
  align-items: center;
  gap: 11px;

  border: 1px solid transparent;
  border-radius: var(--admin-radius-sm);

  color: var(--admin-light-soft);

  font-size: 12px;
  font-weight: 600;

  transition:
    background-color var(--admin-transition),
    border-color var(--admin-transition),
    color var(--admin-transition);
}

.admin-navigation-link:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

.admin-navigation-link.is-active {
  border-color: var(--admin-line-dark);

  background: #ffffff;
  color: #111111;
}

.admin-navigation-link svg {
  width: 17px;
  height: 17px;

  flex: 0 0 auto;
}

.admin-navigation-link > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.admin-navigation-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;

  background: var(--admin-accent);
  color: #ffffff;

  font-size: 9px;
  font-weight: 800;
}

.admin-sidebar-footer {
  padding: 14px;

  border-top: 1px solid var(--admin-line-dark);
}

.admin-sidebar-portal-link {
  min-height: 42px;
  padding: 0 11px;

  display: flex;
  align-items: center;
  gap: 10px;

  border: 1px solid var(--admin-line-dark);
  border-radius: var(--admin-radius-sm);

  color: var(--admin-light-soft);

  font-size: 11px;
  font-weight: 700;
}

.admin-sidebar-portal-link:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

.admin-sidebar-portal-link svg {
  width: 16px;
  height: 16px;
}

.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;

  z-index: 90;

  background: rgba(0, 0, 0, 0.42);
}

/* =========================================================
   CONTENIDO PRINCIPAL
   ========================================================= */

.admin-main-shell {
  min-height: 100vh;
  margin-left: var(--admin-sidebar-width);
}

/* =========================================================
   TOPBAR
   ========================================================= */

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 80;

  height: var(--admin-topbar-height);
  padding: 0 22px;

  display: grid;
  grid-template-columns:
    minmax(240px, 0.8fr)
    minmax(320px, 1.25fr)
    minmax(240px, 0.8fr);

  align-items: center;
  gap: 18px;

  border-bottom: 1px solid var(--admin-line);

  background: rgba(255, 255, 255, 0.96);

  backdrop-filter: blur(12px);
}

.admin-topbar-left,
.admin-topbar-right {
  display: flex;
  align-items: center;
}

.admin-topbar-left {
  gap: 12px;
}

.admin-topbar-right {
  justify-content: flex-end;
  gap: 8px;
}

.admin-page-heading {
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-page-heading span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;

  color: var(--admin-text-muted);
}

.admin-page-heading h1 {
  margin: 0;

  overflow: hidden;

  font-size: 18px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-icon-button {
  width: 38px;
  height: 38px;

  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius-sm);

  background: #ffffff;
  color: var(--admin-text);

  cursor: pointer;

  transition:
    background-color var(--admin-transition),
    border-color var(--admin-transition);
}

.admin-icon-button:hover {
  border-color: #c5c5c5;
  background: #f5f5f5;
}

.admin-icon-button svg {
  width: 17px;
  height: 17px;
}

.admin-global-search {
  position: relative;

  width: 100%;
}

.admin-global-search > svg {
  position: absolute;
  top: 50%;
  left: 14px;

  width: 17px;
  height: 17px;

  transform: translateY(-50%);

  color: var(--admin-text-muted);

  pointer-events: none;
}

.admin-global-search input {
  width: 100%;
  height: 42px;

  padding:
    0
    62px
    0
    42px;

  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius-sm);

  outline: none;

  background: #fafafa;
  color: var(--admin-text);

  font-size: 12px;
}

.admin-global-search input:focus {
  border-color: #a3a3a3;
  background: #ffffff;
}

.admin-global-search input::placeholder {
  color: #999999;
}

.admin-global-search kbd {
  position: absolute;
  top: 50%;
  right: 10px;

  transform: translateY(-50%);

  padding: 4px 7px;

  border: 1px solid var(--admin-line);
  border-radius: 5px;

  background: #ffffff;

  font-family: inherit;
  font-size: 9px;
  color: var(--admin-text-muted);
}

.admin-user-menu {
  position: relative;
}

.admin-user-button {
  min-width: 188px;
  height: 42px;
  padding: 0 10px;

  display: flex;
  align-items: center;
  gap: 9px;

  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius-sm);

  background: #ffffff;
  color: var(--admin-text);

  cursor: pointer;
}

.admin-user-button:hover {
  border-color: #c5c5c5;
}

.admin-user-avatar {
  width: 28px;
  height: 28px;

  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background: #111111;
  color: #ffffff;

  font-size: 10px;
  font-weight: 800;
}

.admin-user-copy {
  min-width: 0;
  flex: 1;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.admin-user-copy strong,
.admin-user-copy small {
  max-width: 100%;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-copy strong {
  font-size: 11px;
}

.admin-user-copy small {
  font-size: 9px;
  color: var(--admin-text-muted);
}

.admin-user-button > svg {
  width: 15px;
  height: 15px;

  color: var(--admin-text-muted);
}

.admin-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;

  z-index: 100;

  width: 230px;
  padding: 8px;

  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius-md);

  background: #ffffff;

  box-shadow: var(--admin-shadow);
}

.admin-user-dropdown-header {
  padding: 10px;

  display: flex;
  flex-direction: column;
  gap: 3px;

  border-bottom: 1px solid var(--admin-line-soft);
}

.admin-user-dropdown-header strong {
  font-size: 12px;
}

.admin-user-dropdown-header span {
  overflow: hidden;

  font-size: 10px;
  color: var(--admin-text-muted);

  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-dropdown-link {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;

  display: flex;
  align-items: center;
  gap: 9px;

  border-radius: 7px;

  background: transparent;
  color: var(--admin-text);

  font-size: 11px;
  font-weight: 600;

  cursor: pointer;
}

.admin-user-dropdown-link:hover {
  background: #f5f5f5;
}

.admin-user-dropdown-link svg {
  width: 16px;
  height: 16px;
}

.admin-user-dropdown-danger {
  color: var(--admin-danger);
}

/* =========================================================
   MAIN
   ========================================================= */

.admin-main {
  min-height:
    calc(
      100vh -
      var(--admin-topbar-height)
    );

  padding: 24px;
}

.admin-view {
  width: 100%;
}

/* =========================================================
   ESTADOS DE RUTA
   ========================================================= */

.admin-route-loading {
  min-height: 300px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;

  color: var(--admin-text-soft);

  font-size: 12px;
}

.admin-spinner {
  width: 18px;
  height: 18px;

  border: 2px solid #dddddd;
  border-top-color: #111111;
  border-radius: 50%;

  animation:
    admin-spin 700ms linear infinite;
}

@keyframes admin-spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-route-error {
  min-height: 220px;
  padding: 30px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;

  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius-md);

  background: #ffffff;
}

.admin-route-error-icon {
  width: 46px;
  height: 46px;

  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border: 1px solid #efc8cc;
  border-radius: 50%;

  color: var(--admin-danger);
}

.admin-route-error-icon svg {
  width: 21px;
  height: 21px;
}

.admin-route-error > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.admin-route-error strong {
  font-size: 14px;
}

.admin-route-error p {
  margin: 4px 0 0;

  font-size: 11px;
  color: var(--admin-text-soft);
}

/* =========================================================
   BOTONES GENERALES
   ========================================================= */

.admin-primary-button,
.admin-secondary-button,
.admin-danger-button {
  min-height: 40px;
  padding: 0 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border-radius: var(--admin-radius-sm);

  font-size: 11px;
  font-weight: 800;

  cursor: pointer;
}

.admin-primary-button {
  background: #111111;
  color: #ffffff;
}

.admin-primary-button:hover {
  background: #292929;
}

.admin-secondary-button {
  border: 1px solid var(--admin-line);

  background: #ffffff;
  color: var(--admin-text);
}

.admin-secondary-button:hover {
  background: #f5f5f5;
}

.admin-danger-button {
  background: var(--admin-danger);
  color: #ffffff;
}

.admin-danger-button:hover {
  background: #a81721;
}

.admin-primary-button svg,
.admin-secondary-button svg,
.admin-danger-button svg {
  width: 16px;
  height: 16px;
}

/* =========================================================
   TOASTS
   ========================================================= */

.admin-toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;

  z-index: 300;

  width: min(360px, calc(100% - 36px));

  display: grid;
  gap: 10px;
}

.admin-toast {
  padding: 14px;

  display: flex;
  align-items: flex-start;
  gap: 11px;

  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius-md);

  background: #ffffff;

  box-shadow: var(--admin-shadow);

  animation:
    admin-toast-in
    180ms ease;
}

@keyframes admin-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-toast-icon {
  width: 30px;
  height: 30px;

  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border-radius: 50%;
}

.admin-toast-icon svg {
  width: 17px;
  height: 17px;
}

.admin-toast.is-success .admin-toast-icon {
  background: rgba(23, 106, 58, 0.09);
  color: var(--admin-success);
}

.admin-toast.is-warning .admin-toast-icon {
  background: rgba(155, 98, 0, 0.09);
  color: var(--admin-warning);
}

.admin-toast.is-error .admin-toast-icon {
  background: rgba(199, 29, 40, 0.09);
  color: var(--admin-danger);
}

.admin-toast-content {
  min-width: 0;
  flex: 1;

  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-toast-content strong {
  font-size: 12px;
}

.admin-toast-content span {
  font-size: 10px;
  line-height: 1.45;

  color: var(--admin-text-soft);
}

.admin-toast-close {
  width: 26px;
  height: 26px;

  display: grid;
  place-items: center;

  border-radius: 5px;

  background: transparent;
  color: var(--admin-text-muted);

  cursor: pointer;
}

.admin-toast-close:hover {
  background: #f3f3f3;
}

.admin-toast-close svg {
  width: 14px;
  height: 14px;
}

/* =========================================================
   MODAL
   ========================================================= */

.admin-modal {
  position: fixed;
  inset: 0;

  z-index: 400;

  display: grid;
  place-items: center;

  padding: 20px;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(0, 0, 0, 0.48);
}

.admin-modal-dialog {
  position: relative;
  z-index: 1;

  width: min(520px, 100%);

  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius-lg);

  background: #ffffff;

  box-shadow: var(--admin-shadow);
}

.admin-confirm-dialog {
  padding: 30px;

  text-align: center;
}

.admin-confirm-icon {
  width: 54px;
  height: 54px;

  margin: 0 auto 16px;

  display: grid;
  place-items: center;

  border: 1px solid #efc8cc;
  border-radius: 50%;

  color: var(--admin-danger);
}

.admin-confirm-icon svg {
  width: 24px;
  height: 24px;
}

.admin-confirm-dialog h2 {
  margin: 0;

  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.admin-confirm-dialog p {
  margin: 10px auto 0;

  max-width: 400px;

  font-size: 12px;
  line-height: 1.55;

  color: var(--admin-text-soft);
}

.admin-confirm-actions {
  margin-top: 24px;

  display: flex;
  justify-content: center;
  gap: 10px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
  .admin-topbar {
    grid-template-columns:
      minmax(220px, 0.8fr)
      minmax(260px, 1fr)
      auto;
  }

  .admin-user-copy {
    display: none;
  }

  .admin-user-button {
    min-width: auto;
  }
}

@media (max-width: 860px) {
  .admin-sidebar {
    transform:
      translateX(-100%);
  }

  .admin-app.is-sidebar-open
  .admin-sidebar {
    transform:
      translateX(0);
  }

  .admin-sidebar-close {
    display: grid !important;

    border-color:
      var(--admin-line-dark);

    background:
      transparent;

    color:
      #ffffff;
  }

  .admin-main-shell {
    margin-left: 0;
  }

  .admin-topbar {
    grid-template-columns:
      minmax(0, 1fr)
      auto;

    padding:
      0
      16px;
  }

  .admin-topbar-center {
    display: none;
  }
}

@media (max-width: 560px) {
  .admin-topbar {
    height: 64px;
  }

  .admin-main {
    padding: 16px;
  }

  .admin-page-heading span {
    display: none;
  }

  .admin-page-heading h1 {
    font-size: 16px;
  }

  .admin-user-button > svg {
    display: none;
  }

  .admin-route-error {
    padding: 22px;

    flex-direction: column;
    text-align: center;
  }

  .admin-confirm-actions {
    flex-direction: column-reverse;
  }

  .admin-confirm-actions button {
    width: 100%;
  }
}