/* ============================================
   RESTOCK — Componentes reutilizables
   ============================================ */

/* Marca */
.brand-mark { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.brand-mark__word { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.tag-mark {
  display: inline-block;
  width: 20px; height: 20px;
  color: var(--brand);
  flex-shrink: 0;
}

/* Tarjetas */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

/* Firma visual: agujero de etiqueta de inventario, como una ficha de stock perforada */
.card--tag { position: relative; padding-left: 46px; }
.card--tag::before {
  content: '';
  position: absolute;
  top: 22px; left: 22px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.14);
}

/* Campos de formulario */
.field { display: block; margin-bottom: 16px; }
.field[hidden] { display: none; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus { border-color: var(--brand); background: var(--surface); outline: none; }

.field__input-wrap { position: relative; display: block; }
.field__input-wrap input { width: 100%; padding-right: 42px; }
.field__toggle-visibility {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--ink-muted); cursor: pointer;
}
.field__toggle-visibility svg { width: 18px; height: 18px; }
.field__toggle-visibility:hover { color: var(--ink); background: var(--paper); }

.field--upload .upload-row { display: flex; align-items: center; gap: 12px; }
.upload-preview { width: 44px; height: 44px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.upload-preview--round { border-radius: 50%; }
.field--upload input[type="file"] { font-size: 13px; color: var(--ink-muted); max-width: 100%; }

.divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.05s ease;
}
.btn:hover { text-decoration: none; }
.btn[hidden] { display: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--block { width: 100%; margin-top: 4px; text-decoration: none; }
.btn--secondary { background: var(--line); color: var(--ink); }
.btn--secondary:hover { background: #C7C7CC; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #CC2F26; }
.btn-text {
  background: none; border: none;
  color: var(--ink-muted); font-weight: 600; font-size: 14px;
  cursor: pointer; padding: 8px 10px;
}
.btn-text:hover { color: var(--ink); }

.icon-btn {
  background: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--ink-muted);
  cursor: pointer; margin-left: 6px;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); }

.link-muted { display: block; margin-top: 14px; font-size: 13px; color: var(--ink-muted); }

/* Solo para lectores de pantalla */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.auth-switch { margin-top: 18px; margin-bottom: 0; }

/* Alertas */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert--error { background: var(--danger-tint); color: var(--danger); }
.alert--success { background: var(--success-tint); color: #1E8E3E; }

/* Avatares */
.avatar {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================
   Sidebar (navegación principal)
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: var(--space-3) var(--space-2);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar__brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 0; }
.sidebar__wordmark { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar__nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
}
.sidebar__nav a svg { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }
.sidebar__nav a:hover { background: var(--paper); color: var(--ink); text-decoration: none; }
.sidebar__nav a.is-active { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.sidebar__nav a[hidden] { display: none; }

.sidebar__footer {
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: var(--space-2);
}

.sidebar__restaurant { position: relative; }
.restaurant-pill {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.restaurant-pill:hover { background: var(--paper); }
.restaurant-pill__logo { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.restaurant-pill__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.restaurant-pill__chevron { width: 14px; height: 14px; flex-shrink: 0; color: var(--ink-muted); }

.restaurant-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  list-style: none; margin: 0; padding: 6px;
  z-index: 20;
}
.restaurant-menu__item { padding: 9px 10px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; }
.restaurant-menu__item:hover { background: var(--paper); }
.restaurant-menu__item.is-active { color: var(--brand); font-weight: 600; }
.restaurant-menu__item--add { color: var(--brand); border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }

.sidebar__user { position: relative; }
.user-pill {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-radius: var(--radius-md);
  padding: 8px 10px; cursor: pointer; text-align: left;
}
.user-pill:hover { background: var(--paper); }
.user-pill__label { min-width: 0; display: flex; flex-direction: column; }
.user-pill__name { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pill__role { font-size: 11px; color: var(--ink-muted); }

.user-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 14px;
  z-index: 20;
}
.user-menu__name { font-weight: 600; margin: 0 0 2px; font-size: 14px; }
.user-menu__role { color: var(--ink-muted); font-size: 12px; margin: 0 0 12px; }
.user-menu__logout {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--danger-tint); color: var(--danger);
  border: none; border-radius: var(--radius-sm);
  padding: 9px; font-weight: 600; font-size: 13px;
  cursor: pointer;
}
.user-menu__logout svg { width: 14px; height: 14px; }

/* Barra superior móvil + cajón deslizante */
.mobile-topbar {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 60;
}
.mobile-topbar__wordmark { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.mobile-topbar__icon-btn {
  background: none; border: none; padding: 6px; border-radius: var(--radius-sm);
  color: var(--ink); cursor: pointer; display: flex;
}
.mobile-topbar__icon-btn svg { width: 22px; height: 22px; }
.mobile-topbar__icon-btn:hover { background: var(--paper); }

.app-shell__backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: 90;
}
.app-shell__backdrop[hidden] { display: none; }

@media (max-width: 880px) {
  body { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-md);
    width: min(var(--sidebar-width), 82vw);
  }
  .sidebar.is-open { transform: translateX(0); }
  .app-shell__backdrop:not([hidden]) { display: block; }
  .mobile-topbar { display: flex; }
}

@media (min-width: 881px) {
  .mobile-topbar { display: none !important; }
}

/* Modales */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-card { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
@media (max-width: 480px) { .field-row { flex-direction: column; gap: 0; } }

.new-category-row { display: flex; gap: 8px; align-items: center; margin: -8px 0 16px; }
.new-category-row[hidden] { display: none; }
.new-category-row input {
  flex: 1; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font-body);
}

/* Aviso de notificación flotante */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  max-width: min(92vw, 420px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 150;
  box-shadow: var(--shadow-md);
}
.toast--success { background: var(--ink); color: #fff; }
.toast--error { background: var(--danger); color: #fff; }
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* Banner de sin conexión */
.offline-banner {
  background: var(--amber);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
}
