/* ——— VARIABLES Y TIPOGRAFÍAS ——— */
:root {
  --font-primary: 'Kanit', sans-serif;
  --font-secondary: 'Alice', serif;
  --font-mono: 'JetBrains Mono', monospace;

  --color-primary: #ff8c42;
  --color-accent: #ffe5d1;
  --color-bg: #f7f7f7;
  --color-surface: rgba(255, 255, 255, 0.85);
  --color-text: #333333;
  --color-text-secondary: #666666;
  --shadow-elevation: 0 4px 12px rgba(0, 0, 0, 0.1);
  --border-radius: 16px;
}

@import url('https://fonts.googleapis.com/css2?family=Alice&family=JetBrains+Mono:wght@100;400;700&family=Kanit:wght@300;400;600&display=swap');

/* ——— RESET BÁSICO ——— */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: var(--font-secondary);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

/* Fondo leve */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('../assets/bg-fixed.jpg') center/cover no-repeat fixed;
  opacity: 0.1;
  z-index: -1;
}

/* ——— TIPOGRAFÍA ——— */
a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-secondary);
  margin-bottom: 0.5rem;
}

/* ——— LAYOUT PRINCIPAL ——— */
.main-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding-top: calc(56px + 1rem);
  /* 1 rem es tu margen habitual */
}

.pedidos-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* ——— BOTONES ——— */
.btn {
  font-family: var(--font-primary);
  border-radius: var(--border-radius);
  transition: background 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: #000;
  /* 👈 agregas esta línea */
}

.btn-primary:hover {
  background: #e57c26;
  border-color: #000;
  /* 👈 también para el hover si quieres que siga negro */
}


.btn-secondary {
  background: var(--color-accent);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: #ffd6b0;
}

.btn-outline-secondary {
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline-secondary:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-close {
  background: transparent;
  border: none;
}

.btn-close::before {
  content: '×';
  font-size: 1.25rem;
  color: var(--color-text-secondary);
}

/* ——— FORMULARIOS ——— */
input,
textarea,
.form-control {
  font-family: var(--font-primary);
}

select,
.form-select {
  font-family: var(--font-mono);
}

/* ——— CARDS ——— */
.card {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-elevation);
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-4px);
}

/* ——— TABLAS ——— */
.table {
  background: var(--color-surface);
  font-family: var(--font-secondary);
  font-size: 0.90rem;
}

.table th,
.table td {
  padding: 0.4rem 0.6rem;
}

/* ——— SIDEBAR DESKTOP ——— */
#sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 250px;
  padding: 1rem .5rem;
  background: var(--color-surface);
  box-shadow: 2px 0 12px rgba(0, 0, 0, .08);
  overflow-y: auto;
  height: calc(100vh - 56px);
  z-index: 1030;
}

#sidebar h5 {
  font-family: var(--font-primary);
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.sidebar-toggle {
  cursor: pointer;
  position: relative;
}

/* Define el tooltip en ::after */
.sidebar-toggle[title]::after {
  content: attr(title);
  position: absolute;
  top: -1.75rem;
  /* justo encima del botón */
  left: 50%;
  /* centrar horizontalmente */
  transform: translateX(-50%);
  background: var(--color-text);
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2000;
  /* por encima de otros elementos */
}

/* Al hacer hover, mostrar el tooltip */
.sidebar-toggle[title]:hover::after {
  opacity: 1;
}

#sidebar.collapsed {
  transform: translateX(-100%);
}


/* ——— NAV LINKS & OFFCANVAS ——— */
#sidebar .nav-link,
.offcanvas .nav-link {
  color: var(--color-text);
  border-radius: var(--border-radius);
  padding: .45rem 1.25rem;
  white-space: nowrap;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}

#sidebar .nav-link:hover,
.offcanvas .nav-link:hover {
  background: var(--color-accent);
  color: var(--color-primary);
}

#sidebar .nav-link.active,
.offcanvas .nav-link.active {
  background: var(--color-primary);
  color: #fff;
}

#sidebar .nav-link i,
.offcanvas .nav-link i {
  margin-right: .5rem;
  font-size: 1rem;
  vertical-align: -2px;
}

/* ——— OFFCANVAS ESTÉTICA ——— */
.offcanvas {
  --bs-offcanvas-width: max-content;
  max-width: 80vw;
  background: var(--color-surface);
  box-shadow: 2px 0 12px rgba(0, 0, 0, .08);
  padding: 1rem .5rem;
}

.offcanvas.show {
  transform: translateX(0);
  visibility: visible;
}

.offcanvas-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 1045;
  pointer-events: none;
}

.offcanvas-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

/* Asegura que el offcanvas esté siempre por encima del backdrop */
.offcanvas {
  z-index: 1050;
  /* por encima del backdrop */
}

/* El backdrop por debajo del panel */
.offcanvas-backdrop {
  z-index: 1040;
  /* justo debajo del offcanvas */
}


/* ——— UTILITIES ——— */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

/* ——— INVENTARIO GRID ——— */
.inventory-grid {
  display: grid;
  gap: 1rem;
}

.inv-card {
  position: relative;
  aspect-ratio: 1/1;
  background-size: cover;
  background-position: center;
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
}

.inv-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
}

.inv-card:hover .inv-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.inv-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .3);
}

.inv-header {
  position: absolute;
  top: .5rem;
  left: .5rem;
  right: .5rem;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  font-size: .85rem;
  margin: 0;
}

.inv-title {
  margin: 0;
  font-family: var(--font-primary);
  font-size: .9rem;
}

.inv-stats {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
  right: .5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: .85rem;
  line-height: 1.3;
  font-family: var(--font-secondary);
  text-shadow: 0 1px 2px #000;
}

/* ——— WRAPPER BOTÓN MÓVIL ——— */
.mobile-menu-wrapper {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 1040;
}

.mobile-menu-wrapper .btn {
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}

/* ───── TOPBAR (header global) ───── */
/* > sidebar (1030) */

.topbar {
  height: 56px;
  /* igual a barra navbar Bootstrap */
  background: var(--color-surface);
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
  padding: 0 .75rem;
  position: fixed;
  /* <-- fixed (no sticky) */
  top: 0;
  left: 0;
  right: 0;
  z-index: 1045;
  /* > sidebar (1030) y offcanvas (1050 backdrop) */
  margin: 12px;
  border-radius: var(--border-radius);

}

/* links del topbar (desktop) */
.top-link {
  color: var(--color-text);
  text-decoration: none;
  padding: .25rem .5rem;
  border-radius: var(--border-radius);
  transition: background .15s;
}

.top-link:hover {
  background: var(--color-accent);
}

.top-link.active {
  background: var(--color-primary);
  color: #fff;
}

/* espacio extra en main para que no se oculte detrás del topbar */
.main-content {
  padding-top: calc(56px + 1rem);
  /* header + tu padding habitual */
}

/* Botones del footer del modal */
.btn-light-orange {
  background: #ffe5d1;
  color: #ff8c42;
  border: none;
}

.btn-light-orange:hover {
  background: #ffd0a3;
}

.btn-deep-orange {
  background: #ff8c42;
  color: #fff;
  border: none;
}

.btn-deep-orange:hover {
  background: #e57c26;
}


/* ——— MEDIA QUERIES CUSTOM ——— */

/* iPhone: ≤767.98px */
@media only screen and (max-width: 767.98px) {
  #sidebar {
    display: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-menu-wrapper {
    display: none;
  }

  .inventory-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  html {
    font-size: calc(100vw / 50);
  }

  .main-content {
    padding-top: calc(56px + .5rem);
  }
}

/* iPad: 768px–1023.98px */
@media only screen and (min-width: 768px) and (max-width: 1023.98px) {
  #sidebar {
    display: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-menu-wrapper {
    display: none;
  }

  .inventory-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  html {
    font-size: 16px;
  }

  .main-content {
    padding-top: calc(56px + .5rem);
  }

  nav.d-lg-flex.top-links {
    display: none !important;
  }

  /* ocultar en móvil */

}


/* Desktop: ≥1024px */
@media only screen and (min-width: 1024px) {
  #sidebar {
    display: block;
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: block;
  }

  .mobile-menu-wrapper {
    display: none;
  }

  .main-content {
    margin-left: 0px;
  }

  .inventory-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .inventory-container,
  .pedidos-container {
    margin-left: 250px;
  }

  html {
    font-size: 16px;
  }
}

@keyframes rotate{from{transform:rotate(0)}to{transform:rotate(1turn)}}
.spin{display:inline-block;animation:rotate 1s linear infinite}
