:root {
  /* Colores */
  --primary: #00342b;
  --on-primary: #ffffff;
  --secondary: #775a19;
  --on-secondary: #ffffff;
  --tertiary: #20302f;
  --on-tertiary: #ffffff;
  --error: #ba1a1a;
  --on-error: #ffffff;

  --primary-container: #004d40;
  --on-primary-container: #7ebdac;
  --secondary-container: #fed488;
  --on-secondary-container: #785a1a;
  --tertiary-container: #364646;
  --on-tertiary-container: #a2b3b3;
  --error-container: #ffdad6;
  --on-error-container: #93000a;

  --background: #f8fafa;
  --on-background: #191c1d;
  --surface: #f8fafa;
  --on-surface: #191c1d;
  --surface-variant: #e1e3e3;
  --on-surface-variant: #3f4945;

  --surface-dim: #d8dada;
  --surface-bright: #f8fafa;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f2f4f4;
  --surface-container: #eceeee;
  --surface-container-high: #e6e8e8;
  --surface-container-highest: #e1e3e3;

  --outline: #707975;
  --outline-variant: #bfc9c4;

  /* Espaciado */
  --unit: 8px;
  --margin-mobile: 16px;
  --margin-desktop: 40px;
  --gutter: 24px;
  --stack-sm: 12px;
  --stack-md: 24px;
  --stack-lg: 48px;

  /* Bordes */
  --radius-sm: 0.125rem;
  --radius-md: 0.25rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;

  /* Sidebar */
  --sidebar-width: 280px;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100%;
}

html {
  height: 100%;
}

/* ===== BASE ===== */
body {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 24px;
  color: var(--on-surface);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
}

/* ===== SIDEBAR ===== */
#sidebar-placeholder {
  position: fixed;
  height: 100vh;
  width: var(--sidebar-width);
  left: 0;
  top: 0;
  background-color: var(--primary);
  color: var(--on-primary);
  display: flex;
  flex-direction: column;
  padding: var(--stack-md);
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  width: 100%;
}

.sidebar-header img {
  height: 150px;
  margin-bottom: var(--stack-sm);
  object-fit: contain;
}

.sidebar-header h1 {
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  text-align: center;
  color: var(--on-primary);
}

.sidebar-header p {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 8px;
  text-align: center;
}

.sidebar-divider {
  width: 100%;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
  margin-bottom: var(--stack-md);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--unit);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  font-size: 1.2rem;
}

.sidebar-nav a.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--on-primary);
  font-weight: 700;
  border-left: 4px solid var(--on-primary-container);
  padding-left: 12px;
}

.sidebar-nav a:hover:not(.active) {
  color: var(--on-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-footer {
  padding: 0 var(--stack-sm);
  margin-top: auto;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-footer a:hover {
  color: var(--on-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

/* ===== HAMBURGER ===== */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background-color: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--on-primary);
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ===== OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ===== MAIN CONTENT ===== */
main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ===== TYPOGRAPHY ===== */
.font-display-lg {
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 48px;
  line-height: 56px;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.font-headline-lg {
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 32px;
  line-height: 40px;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.font-title-md {
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}

.font-body-md {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
}

.font-label-sm {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ===== MATERIAL ICONS ===== */
.material-symbols-outlined,
.material-symbols-failed {
  font-family: "Material Symbols Outlined";
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filled-icon {
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
}

/* ===== MESSAGES ===== */
.message-base {
  position: fixed;
  padding: 15px 20px;
  border-radius: 6px;
  color: rgb(0, 0, 0);
  font-weight: bold;
  border-top: 0.5px solid rgb(0, 0, 0);
  border-bottom: 0.5px solid rgb(0, 0, 0);
  z-index: 1000000;
  width: 100%;
  transition: opacity 0.3s ease;
  max-width: 400px;
  pointer-events: auto;
  box-shadow: 4px 7px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  background-color: white;
  font-family: Arial, Helvetica, sans-serif;
}

.message-show {
  opacity: 1;
  transform: scale(1);
  color: white;
}

.message-else {
  top: 10px;
  left: 85%;
  transform: translate(-50%) scale(0.9);
  animation: slideIn 0.3s ease;
}

.message-delete {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background-color: rgb(255, 255, 255);
  color: black;
}

.message-content {
  color: black;
  text-align: center;
  font-size: 30px;
}

.accept-btn,
.cancel-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease;
  width: 100%;
  margin-bottom: 5px;
  text-align: center;
  font-size: 20px;
}

.accept-btn {
  margin-top: 10px;
  margin-right: 10px;
  background: #004d40;
  color: #fff;
  font-weight: bold;
}

.cancel-btn {
  margin-right: 10px;
  background: #fff;
  border: 1px solid #004d40;
  color: #004d40;
  font-weight: bold;
}

.accept-btn:hover {
  background: #00342b;
}
.cancel-btn:hover {
  background: #efefef;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(33, 33, 33, 0.65);
  backdrop-filter: blur(4px);
}

/* ===== SKELETONS ===== */
.skeleton {
  background: #e0e0e0;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}
.skeleton-title {
  height: 1.75rem;
  width: 40%;
}
.skeleton-card {
  height: 100%;
  width: 100%;
  border-radius: 0.625rem;
}
.skeleton-chart {
  height: 310px;
  width: 100%;
  border-radius: 4px;
}
.skeleton-mini-chart {
  height: 130px;
  width: 100%;
  border-radius: 4px;
}
.skeleton-cell {
  height: 1.2rem;
  border-radius: 4px;
}
.skeleton-stats {
  height: 8rem;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.skeleton-active-motors {
  height: 125px;
  width: 100%;
  margin-bottom: 1rem;
  border-radius: 0.625rem;
}
.skeleton-motor {
  height: 180px;
  width: 100%;
  border-radius: 0.625rem;
}
.skeleton-alert {
  height: 70px;
  width: 100%;
  border-radius: 0.625rem;
}
.skeleton-graph {
  height: 100%;
  width: 100%;
  border-radius: 0.625rem;
}
.skeleton-panel {
  display: flex;
  height: 100%;
  border-radius: 12px;
}

/* ===== FAILED CONNECTION ===== */
.failed-container {
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: center;
}

.failed-square {
  display: flex;
  flex-direction: column;
  align-self: center;
  height: 75%;
  width: 75%;
  border-radius: 12px;
  box-shadow: 0 4px 20px #0000001b;
  border: 1px solid #bfc9c44d;
  justify-content: center;
}

.failed-icon-container {
  display: flex;
  justify-content: center;
  font-size: 4rem;
  width: 100%;
}

.failed-icon-bg {
  background-color: #ffebee;
  padding: 25px;
  border-radius: 18px;
}

.failed-icon {
  font-size: 8rem;
  color: #c62828;
  font-weight: 300;
  line-height: 8rem;
}

.failed-title {
  font-family: "Hanken Grotesk", sans-serif;
  margin-top: 2rem;
  justify-items: center;
  font-size: 3rem;
  line-height: 3rem;
  margin-bottom: 2rem;
  font-weight: 600;
}

.failed-content {
  font-family: "Hanken Grotesk", sans-serif;
  padding: 0 6rem 1rem;
  font-size: 1.5rem;
  line-height: 2rem;
  text-align: center;
}

.loader {
  width: 45px;
  aspect-ratio: 1;
  --_g: no-repeat radial-gradient(farthest-side, #ffffff 94%, #ffffff00);
  background:
    var(--_g) 0 0,
    var(--_g) 100% 0,
    var(--_g) 100% 100%,
    var(--_g) 0 100%;
  background-size: 45% 45%;
  animation: l38 0.5s infinite;
}
@keyframes l38 {
  100% {
    background-position:
      100% 0,
      100% 100%,
      0 100%,
      0 0;
  }
}

.hidden {
  display: none;
}

.failed-button {
  margin-top: 1rem;
  align-self: center;
  background-color: #00342b;
  width: 30%;
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding: 5px 10px;
  color: white;
  align-items: center;
  border-radius: 5px;
  gap: 10px;
  transition: 0.3s ease;
}

.failed-button:hover {
  background-color: #004d40;
  cursor: pointer;
}

.failed-button p {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.2rem;
}

/*TOKEN WARNING STUFF*/

.token-warning-square {
  display: flex;
  flex-direction: column;
  background: white;
  padding: 20px;
  align-items: center;
  border-radius: 18px;
  min-width: 450px;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tw-title {
  font-size: 36px;
  font-weight: 300;
  margin-bottom: 24px;
  margin-top: 12px;
}

.tw-text {
  font-size: 22px;
  margin-bottom: 18px;
}

.tw-button {
  background-color: #004d40;
  color: white;
  padding: 10px 24px;
  border-radius: 12px;
  border: none;
  transition: 0.3s ease;
}

.tw-button:hover {
  background-color: #00342b;
}

.tw-button p {
  font-size: 20px;
  font-weight: 300;
}

/* ===== RESPONSIVE ===== */

/* ── Tablet & Mobile (768px and below) ── */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }
  
    .message-base:not(.message-delete) {
      left: 50%;
      top: 10%;
    }

  #sidebar-placeholder {
    transform: translateX(-100%);
    width: min(260px, 75vw);
  }

  #sidebar-placeholder.open {
    transform: translateX(0);
  }

  main {
    margin-left: 0;
    padding-top: 60px;
  }

  .failed-square {
    width: 90%;
    height: auto;
    padding: 30px 20px;
  }

  .failed-content {
    padding: 0 1.5rem 1rem;
    font-size: 1rem;
  }

  .failed-title {
    font-size: 2rem;
    line-height: 2.5rem;
  }

  .failed-button {
    width: 60%;
  }

  .message-base {
    max-width: 90%;
  }
}

/* ── Mobile (425px and below) ── */
@media (max-width: 425px) {
  #sidebar-placeholder {
    width: 80vw;
  }

  .failed-title {
    font-size: 1.5rem;
    line-height: 2rem;
  }

  .failed-icon {
    font-size: 5rem;
  }

  .failed-button {
    width: 80%;
  }
  
  
}
