/* Sidebar expandible (formato del modelo, módulos de inmob) */

body:has(.sidebar) {
  --page: #e8ecf1;
  --surface: #ffffff;
  --text: #3d434b;
  --soft: #6e747d;
  --muted: #a8adb5;
  --border: #eef0f3;
  --chip: #f4f5f7;
  --accent: #007aff;
  --active: rgb(0 122 255 / 10%);
  --sheen: rgb(255 255 255 / 45%);
  --shadow: 0 24px 60px rgb(31 41 55 / 12%);
  min-height: 100vh;
  margin: 0;
  padding: 24px 24px 32px 132px;
  background:
    radial-gradient(120% 80% at 20% 0%, var(--sheen), transparent 60%),
    var(--page);
  color: var(--text);
  font-family: Poppins, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: visible;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body:has(.sidebar) {
  --page: #090b10;
  --surface: #1c2026;
  --text: #dfe3e8;
  --soft: #9aa0a9;
  --muted: #6f757e;
  --border: #2b2f38;
  --chip: #272b33;
  --accent: #0a84ff;
  --active: rgb(10 132 255 / 18%);
  --sheen: rgb(255 255 255 / 4%);
  --shadow: none;
  --color-fondo: #090b10;
  --color-fondo-suave: #12151b;
  --color-blanco: #1c2026;
  --color-texto: #dfe3e8;
  --color-texto-claro: #9aa0a9;
  --color-borde: #2b2f38;
  --color-borde-suave: rgb(255 255 255 / 6%);
  --color-primario: #dfe3e8;
  --color-secundario: #9aa0a9;
  --color-acento: #0a84ff;
  --color-acento-hover: #409cff;
  --sombra-suave: none;
  --sombra-media: none;
  --gradiente-primario: linear-gradient(135deg, #1c2026, #090b10);
}

.sidebar .icon {
  flex: 0 0 auto;
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar {
  position: fixed;
  top: 24px;
  left: 24px;
  bottom: 32px;
  z-index: 1030;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 84px;
  padding: 20px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  white-space: nowrap;
  transition: width 0.35s ease;
}

.sidebar:is(:hover, .is-open) {
  width: 264px;
}

.sidebar .profile {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 44px;
  color: inherit;
  text-decoration: none;
}

.sidebar .avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--chip);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

.sidebar .profile--active .avatar {
  box-shadow: 0 0 0 2px var(--accent);
}

.sidebar .details {
  flex: 1 1 auto;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar .name {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.sidebar .role {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.sidebar .chevron {
  width: 20px;
  height: 20px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar:is(:hover, .is-open) :is(.details, .chevron) {
  opacity: 1;
  transition: opacity 0.25s 0.1s;
}

.sidebar .search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: width 0.35s ease;
}

.sidebar:is(:hover, .is-open) .search {
  width: 100%;
}

.sidebar .search input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  padding: 0 44px 0 14px;
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar:is(:hover, .is-open) .search input {
  opacity: 1;
  transition: opacity 0.25s 0.1s;
}

.sidebar .search input::placeholder {
  color: var(--muted);
}

.sidebar .search input:focus {
  outline: 0;
}

.sidebar .search > .icon {
  position: absolute;
  right: 11px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar .item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  color: var(--soft);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar .item.is-hidden {
  display: none;
}

.sidebar .item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  translate: 0 -50%;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  transition:
    width 0.35s ease,
    height 0.35s ease,
    background-color 0.2s;
}

.sidebar:is(:hover, .is-open) .item::before {
  width: 100%;
  height: 56px;
}

.sidebar .item > .icon,
.sidebar .item p {
  position: relative;
}

.sidebar .item--active {
  color: var(--accent);
}

.sidebar .item--active::before {
  background: var(--active);
}

.sidebar hr {
  height: 1px;
  margin: 12px 0;
  border: 0;
  background: var(--border);
}

.sidebar .item > .icon {
  margin: 0 11px;
}

.sidebar .item p {
  margin: 0;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar:is(:hover, .is-open) .item p {
  opacity: 1;
  transition: opacity 0.25s 0.1s;
}

.sidebar .item:hover {
  color: var(--accent);
}

.sidebar .actions {
  position: relative;
  flex-shrink: 0;
  height: calc((var(--action-count, 4) - 1) * 52px + 44px);
  margin-top: auto;
  transition: height 0.35s ease;
}

.sidebar:is(:hover, .is-open) .actions {
  height: 44px;
}

.sidebar .action {
  position: absolute;
  left: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--chip);
  color: var(--soft);
  cursor: pointer;
  text-decoration: none;
  transition:
    top 0.35s ease,
    left 0.35s ease,
    background-color 0.2s,
    color 0.2s;
}

.sidebar .action:nth-child(1) {
  top: calc((var(--action-count, 4) - 1) * 52px);
}

.sidebar .action:nth-child(2) {
  top: calc((var(--action-count, 4) - 2) * 52px);
}

.sidebar .action:nth-child(3) {
  top: calc((var(--action-count, 4) - 3) * 52px);
}

.sidebar .action:nth-child(4) {
  top: calc((var(--action-count, 4) - 4) * 52px);
}

.sidebar .action:hover {
  background: var(--accent);
  color: #ffffff;
}

.sidebar:is(:hover, .is-open) .action {
  top: 0;
}

.sidebar:is(:hover, .is-open) .action:nth-child(2) {
  left: 60px;
}

.sidebar:is(:hover, .is-open) .action:nth-child(3) {
  left: 120px;
}

.sidebar:is(:hover, .is-open) .action:nth-child(4) {
  left: 180px;
}

.sidebar .action .icon {
  width: 20px;
  height: 20px;
}

.sidebar .action .sun,
html[data-theme="dark"] .sidebar .action .moon {
  display: none;
}

html[data-theme="dark"] .sidebar .action .sun {
  display: block;
}

.sidebar-toggle,
.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  body:has(.sidebar) {
    padding: 72px 16px 24px;
  }

  .sidebar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1040;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--surface);
    color: var(--soft);
    box-shadow: var(--shadow);
    cursor: pointer;
  }

  .sidebar-toggle .icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1025;
    border: 0;
    padding: 0;
    background: rgb(15 23 42 / 35%);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .sidebar {
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 264px;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.35s ease, width 0.35s ease;
  }

  .sidebar.is-open {
    transform: none;
  }
}

html[data-theme="dark"] .barra-filtros .form-control,
html[data-theme="dark"] .barra-filtros .form-select {
  background-color: #272b33;
  color: var(--text);
}

html[data-theme="dark"] .barra-filtros .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239aa0a9' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 6.646a.5.5 0 0 1 .708 0L8 9.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E");
}
