@import "../../../../main/css/tokens.css";

html.admin-route body {
  background: var(--wesp-admin-bg);
}

html.admin-route .ant-layout-sider-trigger {
  background: var(--marquee-bg) !important;
  color: var(--foreground) !important;
  border-top: 1px solid var(--border-light) !important;
}

html.admin-route .ant-layout-sider-trigger:hover {
  background: var(--primary-tint) !important;
  color: var(--foreground) !important;
}

html.admin-route .ant-card {
  background: var(--wesp-admin-surface) !important;
  border-color: var(--border-light) !important;
  box-shadow: none !important;
  border-radius: var(--admin-card-radius) !important;
  overflow: hidden;
}

html.admin-route .ant-btn-primary {
  background: var(--wesp-admin-primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

html.admin-route .ant-btn-dangerous,
html.admin-route .ant-btn-dangerous.ant-btn-primary {
  background: #cd3838 !important;
  border-color: transparent !important;
  color: #fff !important;
}

html.admin-route .ant-btn-dangerous:hover,
html.admin-route .ant-btn-dangerous.ant-btn-primary:hover {
  background: #e94b4b !important;
  color: #fff !important;
}

html.admin-route .ant-input,
html.admin-route .ant-input-affix-wrapper,
html.admin-route .ant-select-selector,
html.admin-route .ant-input-number {
  background: var(--surface) !important;
  border-color: var(--border-light) !important;
  color: var(--foreground) !important;
}

html.admin-route .ant-select-dropdown,
html.admin-route .ant-modal-content,
html.admin-route .ant-modal-header {
  background: var(--surface) !important;
  color: var(--foreground) !important;
}

html.admin-route .ant-modal-title,
html.admin-route .ant-modal-close {
  color: var(--foreground) !important;
}

html.admin-route .ant-switch.ant-switch-checked {
  background: var(--wesp-admin-primary) !important;
}

html.admin-route .ant-typography.ant-typography-secondary,
html.admin-route .ant-list-item-meta-description {
  color: var(--muted) !important;
}

html.admin-route .ant-table {
  background: var(--surface) !important;
  color: var(--foreground) !important;
}

html.admin-route .ant-table-thead > tr > th {
  background: var(--marquee-bg) !important;
  color: var(--muted) !important;
  border-bottom-color: var(--border-light) !important;
}

html.admin-route .ant-table-tbody > tr > td {
  border-bottom-color: var(--border-light) !important;
}

.wesp-admin-layout {
  min-height: 100vh;
  background: var(--wesp-admin-bg) !important;
  --wesp-admin-sider-width: 80px;
}

.wesp-admin-layout.wesp-admin-sider-expanded {
  --wesp-admin-sider-width: 256px;
}

.wesp-admin-sider.ant-layout-sider {
  background: var(--admin-sider-bg) !important;
  border-right: 1px solid var(--admin-stroke);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  z-index: 100;
  flex: 0 0 var(--wesp-admin-sider-width) !important;
  max-width: var(--wesp-admin-sider-width) !important;
  min-width: var(--wesp-admin-sider-width) !important;
  width: var(--wesp-admin-sider-width) !important;
  transition:
    flex 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.wesp-admin-sider.ant-layout-sider-collapsed {
  flex: 0 0 80px !important;
  max-width: 80px !important;
  min-width: 80px !important;
  width: 80px !important;
}

.wesp-admin-layout > .ant-layout {
  margin-left: var(--wesp-admin-sider-width);
  min-height: 100vh;
  background: transparent;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.wesp-admin-sider .ant-layout-sider-children {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 48px;
}

.wesp-admin-sider .ant-menu {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 0 8px !important;
  background: transparent !important;
  border-inline-end: none !important;
}

.wesp-admin-sider .ant-menu-item {
  cursor: pointer;
  margin: 4px 8px !important;
  width: calc(100% - 16px) !important;
  display: flex !important;
  align-items: center;
  gap: 10px;
  height: 40px !important;
  line-height: 40px !important;
  border-radius: 8px;
  color: var(--wesp-admin-text) !important;
}

.wesp-admin-sider .ant-menu-item:hover {
  background: var(--admin-primary-hover) !important;
}

.wesp-admin-sider .ant-menu-item-selected {
  background: var(--admin-primary-selected) !important;
  color: var(--primary) !important;
}

.wesp-admin-sider .ant-menu-item .anticon {
  color: var(--muted);
  font-size: 16px;
}

.wesp-admin-sider .ant-menu-item-selected .anticon {
  color: var(--primary);
}

.wesp-admin-sider .wesp-menu-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  max-width: 16rem;
  opacity: 1;
  transition:
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
    max-width 0.36s cubic-bezier(0.4, 0, 0.2, 1) 0.08s,
    margin 0.25s ease,
    padding 0.25s ease;
}

.wesp-admin-sider.ant-layout-sider-collapsed .wesp-menu-label {
  max-width: 0 !important;
  opacity: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}

.wesp-admin-sider.ant-layout-sider-collapsed .ant-menu-item {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0;
  margin-inline: 8px !important;
  width: calc(100% - 16px) !important;
  padding-inline: 0 !important;
}

.wesp-admin-sider.ant-layout-sider-collapsed .ant-menu-item .ant-menu-item-icon {
  margin-inline: 0 !important;
  flex: none !important;
}

.wesp-admin-sider.ant-layout-sider-collapsed .ant-menu-title-content {
  width: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  flex: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.wesp-admin-sider.ant-layout-sider-collapsed .ant-menu-inline-collapsed > .ant-menu-item {
  padding-inline: 0 !important;
}

.wesp-admin-sider:not(.ant-layout-sider-collapsed) .ant-menu-item {
  padding-inline: 12px !important;
}

.wesp-admin-sider .ant-layout-sider-trigger,
.wesp-admin-sider.ant-layout-sider-light .ant-layout-sider-trigger,
.wesp-admin-sider.ant-layout-sider-dark .ant-layout-sider-trigger {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 48px !important;
  line-height: 48px !important;
  border-top: 1px solid var(--border-light) !important;
  background: var(--marquee-bg) !important;
  color: var(--foreground) !important;
  box-shadow: none !important;
}

.wesp-admin-sider .ant-layout-sider-trigger:hover,
.wesp-admin-sider.ant-layout-sider-light .ant-layout-sider-trigger:hover,
.wesp-admin-sider.ant-layout-sider-dark .ant-layout-sider-trigger:hover {
  background: var(--primary-tint) !important;
  color: var(--foreground) !important;
}

.wesp-sider-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--foreground);
  opacity: 0.9;
}

.wesp-sider-trigger-icon .anticon {
  color: inherit;
}

.ant-tooltip.ant-menu-inline-collapsed-tooltip .ant-tooltip-inner {
  background: var(--surface);
  color: var(--foreground);
  font-size: 12px;
  border: 1px solid var(--border-light);
}

.ant-tooltip.ant-menu-inline-collapsed-tooltip .ant-tooltip-arrow::before {
  background: var(--surface);
}

.wesp-admin-content {
  margin: 16px;
  padding: 0;
  background: transparent !important;
  color: var(--wesp-admin-text);
  min-width: 0;
}

.wesp-admin-main {
  min-width: 0;
}

.wesp-admin-content-topbar {
  margin-bottom: 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 44px;
}

.wesp-admin-content-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.wesp-admin-content-topbar .ant-btn {
  border-radius: 20px;
  background: var(--admin-btn-bg);
  border-color: var(--admin-btn-border);
  color: var(--admin-btn-text);
  height: 32px;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 500;
}

.wesp-admin-content-topbar .ant-btn-primary {
  background: var(--wesp-admin-primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.wesp-admin-panel-card.ant-card {
  border-radius: var(--admin-card-radius);
  border: 1px solid var(--border-light);
  background: var(--wesp-admin-surface);
}

.wesp-admin-panel-card .ant-card-head {
  border-bottom-color: var(--border-light);
  min-height: 40px;
  padding: 0 14px;
}

.wesp-admin-panel-card .ant-card-body {
  padding: 14px;
}

.wesp-admin-panel-card .ant-card-head-title,
.wesp-admin-panel-card .ant-typography,
.wesp-admin-grid .ant-typography,
.wesp-admin-grid .ant-list-item-meta-title,
.wesp-admin-grid .ant-list-item-meta-description {
  color: var(--wesp-admin-text) !important;
}

.wesp-admin-section {
  display: block;
}

.wesp-admin-dashboard {
  display: grid;
  gap: 16px;
}

.wesp-dashboard-sticky.ant-card {
  position: sticky;
  top: 0;
  z-index: 20;
}

.wesp-dashboard-sticky.ant-card .ant-card-body {
  padding: 12px 14px;
}

.wesp-admin-gauges-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.wesp-gauge {
  text-align: center;
}

.wesp-gauge-ring {
  position: relative;
  width: 120px;
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 1;
}

.wesp-gauge-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wesp-gauge-track {
  stroke: var(--border-light);
}

.wesp-gauge-fill {
  stroke: var(--wesp-admin-primary);
  transition: stroke-dashoffset 0.45s ease;
}

.wesp-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.wesp-gauge-pct {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wesp-gauge-pct-suffix {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.55;
  margin-left: 1px;
}

.wesp-gauge-ring--adm {
  width: 120px;
  height: 120px;
}

.wesp-gauge-caption {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.wesp-gauge-caption span[data-gauge-detail] {
  opacity: 0.75;
  font-weight: 500;
}

.wesp-dash-service-row.ant-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

.wesp-dash-service-row > .ant-col {
  display: flex;
  flex-direction: column;
}

.wesp-dash-service-row .wesp-dash-service-card {
  flex: 1 1 auto;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.wesp-dash-service-card .ant-card-body {
  padding-top: 12px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.wesp-dash-service-row .wesp-dash-manage-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wesp-dash-manage-list {
  font-size: 13px;
  line-height: 1.4;
}

.wesp-dash-manage-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.wesp-dash-manage-row:first-child {
  padding-top: 2px;
}

.wesp-dash-manage-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.wesp-dash-manage-row--service {
  margin-top: 4px;
  padding-top: 16px;
}

.wesp-dash-manage-info {
  flex: 1 1 140px;
  min-width: 0;
}

.wesp-dash-manage-title {
  display: block;
  font-weight: 600;
  font-size: 13px;
}

.wesp-dash-manage-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.65;
  line-height: 1.35;
}

.wesp-dash-manage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.wesp-dash-wesp-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.wesp-dash-wesp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  line-height: 1.4;
}

.wesp-dash-wesp-label {
  opacity: 0.65;
  flex-shrink: 0;
}

.wesp-dash-wesp-value {
  font-weight: 500;
  text-align: right;
}

.wesp-dash-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.wesp-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.wesp-status-dot--ok {
  background: var(--wesp-admin-primary);
}

.wesp-traffic-card .ant-card-body {
  padding: 16px 20px 20px;
}

.wesp-traffic-two-col {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.wesp-traffic-col {
  flex: 1 1 160px;
  min-width: 0;
}

.wesp-traffic-label {
  font-size: 13px;
  opacity: 0.65;
  margin-bottom: 8px;
}

.wesp-traffic-value {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.wesp-traffic-arrow,
.wesp-traffic-icon {
  opacity: 0.75;
  margin-right: 4px;
}

.wesp-admin-stats-row {
  margin-top: 0;
}

.wesp-tag {
  background: var(--marquee-bg) !important;
  border: 1px solid var(--border-light) !important;
  color: var(--muted) !important;
}

.wesp-tag--ok {
  background: var(--primary-tint) !important;
  border-color: var(--admin-tag-ok-border) !important;
  color: var(--primary) !important;
}

.wesp-tag--warn {
  background: #fff8e6 !important;
  border-color: rgba(212, 167, 44, 0.45) !important;
  color: #9a6700 !important;
}

.wesp-tag--error {
  background: #fff1f0 !important;
  border-color: rgba(205, 56, 56, 0.35) !important;
  color: #cd3838 !important;
}

.wesp-admin-stat-card.ant-card {
  background: var(--wesp-admin-surface) !important;
  border: 1px solid var(--wesp-admin-stroke) !important;
  border-radius: var(--admin-card-radius);
  box-shadow: none !important;
}

.wesp-admin-stat-card.ant-card .ant-card-body {
  padding: 16px !important;
}

.wesp-admin-stat-label {
  opacity: 0.65;
  font-size: 13px;
  color: var(--wesp-admin-soft);
}

.wesp-admin-stat-value {
  font-size: 26px;
  font-weight: 600;
  margin-top: 6px;
  color: var(--wesp-admin-text);
  line-height: 1.2;
}

.wesp-admin-grid .ant-card {
  background: var(--wesp-admin-surface) !important;
  border-color: var(--wesp-admin-stroke) !important;
  border-radius: var(--admin-card-radius) !important;
}

.wesp-admin-grid .ant-table {
  background: var(--wesp-admin-surface) !important;
  color: var(--wesp-admin-text) !important;
}

.wesp-admin-grid .ant-table-thead > tr > th {
  background: var(--admin-table-header) !important;
  border-bottom-color: var(--wesp-admin-stroke) !important;
  color: var(--wesp-admin-soft) !important;
}

.wesp-admin-grid .ant-table-tbody > tr > td {
  border-bottom-color: var(--border-light) !important;
  color: var(--wesp-admin-text) !important;
}

.wesp-admin-grid {
  display: grid;
  gap: 10px;
}

.wesp-admin-log {
  margin: 0;
  background: linear-gradient(165deg, #0a0f0d 0%, #060807 48%, #0d1210 100%);
  color: #7ee787;
  border-radius: 10px;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.wesp-admin-block {
  position: relative;
}

html.wesp-admin-loading #root {
  pointer-events: none;
}

.wesp-admin-skel-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 2;
  background: linear-gradient(
    105deg,
    rgba(0, 0, 0, 0.02) 0%,
    rgba(0, 0, 0, 0.02) 34%,
    rgba(0, 0, 0, 0.05) 50%,
    rgba(0, 0, 0, 0.02) 66%,
    rgba(0, 0, 0, 0.02) 100%
  );
  background-size: 240% 100%;
  animation: wesp-admin-skel-shimmer 0.95s ease-in-out infinite;
  transition: opacity 0.38s ease;
}

@keyframes wesp-admin-skel-shimmer {
  0% {
    background-position: 240% 0;
  }
  100% {
    background-position: -240% 0;
  }
}

html.wesp-admin-loaded .wesp-admin-skel-overlay {
  opacity: 0;
  visibility: hidden;
}

html.wesp-admin-loaded .wesp-admin-block {
  animation: wesp-admin-block-reveal 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--wesp-reveal-i, 0) * 38ms);
}

@keyframes wesp-admin-block-reveal {
  from {
    opacity: 0.55;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wesp-admin-section-enter {
  animation: wesp-admin-section-tween 0.44s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes wesp-admin-section-tween {
  from {
    opacity: 0.45;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

html.admin-route[data-admin-theme="dark"] .wesp-tag {
  background: rgba(11, 10, 16, 0.45) !important;
  border: 1px solid rgba(186, 184, 208, 0.16) !important;
  color: rgba(236, 236, 241, 0.82) !important;
}

html.admin-route[data-admin-theme="dark"] .wesp-tag--ok {
  background: rgba(90, 154, 130, 0.18) !important;
  border-color: var(--admin-tag-ok-border) !important;
  color: var(--admin-success) !important;
}

html.admin-route[data-admin-theme="dark"] .wesp-tag--warn {
  background: rgba(232, 184, 74, 0.12) !important;
  border-color: rgba(232, 184, 74, 0.4) !important;
  color: #e8b84a !important;
}

html.admin-route[data-admin-theme="dark"] .wesp-tag--error {
  background: rgba(233, 75, 75, 0.14) !important;
  border-color: rgba(233, 75, 75, 0.35) !important;
  color: #ff9c9c !important;
}

html.admin-route[data-admin-theme="dark"] .wesp-admin-skel-overlay {
  background: linear-gradient(
    105deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(255, 255, 255, 0.02) 34%,
    rgba(255, 255, 255, 0.07) 50%,
    rgba(255, 255, 255, 0.02) 66%,
    rgba(255, 255, 255, 0.02) 100%
  );
}

html.admin-route[data-admin-theme="dark"] .wesp-admin-sider .ant-menu-item-selected {
  color: var(--admin-success) !important;
}

html.admin-route[data-admin-theme="dark"] .wesp-admin-sider .ant-menu-item-selected .anticon {
  color: var(--admin-success);
}

html.admin-route[data-admin-theme="dark"] .wesp-admin-sider .ant-menu-item .anticon {
  color: var(--admin-soft);
}

html.admin-route[data-admin-theme="dark"] .wesp-gauge-track {
  stroke: rgba(186, 184, 208, 0.18);
}

html.admin-route[data-admin-theme="dark"] .wesp-admin-log {
  background: linear-gradient(165deg, #0b0a10 0%, #15141c 48%, #0b0a10 100%);
  color: #6bc4a8;
}

@media (max-width: 768px) {
  .wesp-admin-layout.ant-layout-has-sider {
    flex-direction: column;
  }

  .wesp-admin-sider.ant-layout-sider {
    position: static;
    inset: auto;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    height: auto !important;
  }

  .wesp-admin-layout > .ant-layout {
    margin-left: 0;
  }

  .wesp-admin-sider .ant-layout-sider-children {
    padding-bottom: 0;
  }

  .wesp-admin-sider .ant-layout-sider-trigger {
    display: none;
  }

  .wesp-admin-sider.ant-layout-sider-collapsed .wesp-menu-label {
    max-width: 16rem !important;
    opacity: 1 !important;
    pointer-events: auto;
  }

  .wesp-admin-sider.ant-layout-sider-collapsed .ant-menu-item {
    justify-content: flex-start;
    gap: 10px;
    padding-inline: 16px !important;
  }

  .wesp-admin-sider.ant-layout-sider-collapsed .ant-menu-title-content {
    width: auto !important;
    opacity: 1 !important;
    flex: 1 !important;
    overflow: visible !important;
  }

  .wesp-admin-content {
    margin: 12px;
  }

  .wesp-admin-content-topbar {
    justify-content: flex-start;
  }

  .wesp-admin-gauges-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .wesp-admin-sider.ant-layout-sider,
  .wesp-admin-layout > .ant-layout,
  .wesp-admin-sider .wesp-menu-label,
  .wesp-admin-sider .ant-menu-item {
    transition: none !important;
  }
}
