
:root {
  --admin-primary: #172c39;
  --admin-accent: #36796f;
  --admin-background: #f3f5f8;
  --admin-white: #ffffff;
  --admin-text: #243746;
  --admin-muted: #64748b;
  --admin-border: #e1e6eb;
  --admin-danger: #dc2626;
  --admin-warning: #b7791f;
  --admin-success: #15803d;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--admin-background);
  color: var(--admin-text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

a {
  color: var(--admin-accent);
  text-decoration: none;
}

h1, h2, h3, p {
  margin-top: 0;
}

.muted {
  color: var(--admin-muted);
}

/* INICIO DE SESION */

.auth-container {
  width: min(440px, calc(100% - 32px));
  margin: 70px auto;
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand h1 {
  color: var(--admin-primary);
  font-size: 30px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.auth-card {
  padding: 32px;
  background: white;
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  box-shadow: 0 8px 30px #172c3910;
}

.auth-card form {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  color: var(--admin-text);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--admin-accent);
  outline-offset: 1px;
}

/* BOTONES */

button, .btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: var(--admin-accent);
  color: white;
  font-weight: 600;
  transition: background .2s;
}

button:hover {
  filter: brightness(.94);
}

button.secondary, .btn-secondary {
  background: #e8eef1;
  color: var(--admin-primary);
}

.btn-danger {
  background: var(--admin-danger);
}

.btn-small {
  padding: 7px 11px;
  font-size: 12px;
}

/* ESTRUCTURA PRINCIPAL */

.admin-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--admin-primary);
  color: white;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 8px 10px 26px;
}

.sidebar-brand h2 {
  font-size: 21px;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.sidebar-brand span {
  font-size: 11px;
  color: #a7bdc7;
  letter-spacing: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-button {
  width: 100%;
  background: transparent;
  color: #d5e0e6;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 8px;
  font-weight: 500;
}

.nav-button:hover {
  background: #ffffff12;
}

.nav-button.active {
  background: #345b64;
  color: white;
}

.nav-icon {
  width: 24px;
  text-align: center;
  font-size: 17px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
}

.sidebar-footer button {
  width: 100%;
  background: #ffffff12;
  color: white;
}

.sidebar-footer a {
  display: block;
  color: #b9cbd3;
  text-align: center;
  margin: 15px 0;
}

/* CONTENIDO PRINCIPAL */

.admin-main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.topbar h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

.eyebrow {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.admin-section {
  animation: appear .2s ease;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* TARJETAS E INDICADORES */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  padding: 22px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  box-shadow: 0 3px 10px #172c3905;
}

.stat-label {
  color: var(--admin-muted);
  font-size: 13px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--admin-primary);
  overflow-wrap: anywhere;
}

.stat-description {
  color: var(--admin-muted);
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-card {
  background: white;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 20px;
}

.admin-card h2 {
  font-size: 18px;
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

/* TABLAS */

.table-container {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  background: #f3f6f8;
  color: var(--admin-muted);
  padding: 13px;
  font-size: 12px;
  font-weight: 600;
}

.admin-table td {
  padding: 15px 13px;
  border-bottom: 1px solid #edf0f3;
}

.admin-table tbody tr:hover {
  background: #f8fafc;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

/* ESTADOS */

.status {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-pending {
  background: #fff1d6;
  color: #98620b;
}

.status-success {
  background: #dcfce7;
  color: #166534;
}

.status-danger {
  background: #fee2e2;
  color: #991b1b;
}

.status-info {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-neutral {
  background: #e8eef1;
  color: #475569;
}

/* BUSQUEDA Y FILTROS */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.filters input, .filters select {
  width: auto;
  flex: 1;
  min-width: 150px;
}

/* INVENTARIO Y DISPONIBILIDAD */

.stock-group {
  margin-bottom: 24px;
}

.stock-group h3 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-primary);
}

.stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 0;
  border-bottom: 1px solid #edf0f3;
}

.stock-state {
  display: block;
  color: var(--admin-success);
  font-size: 12px;
  margin-top: 5px;
}

.stock-state.unavailable {
  color: var(--admin-danger);
}

.stock-input {
  width: 85px;
  text-align: center;
}

/* GRAFICOS */

.chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  min-height: 200px;
  gap: 10px;
  padding-top: 20px;
}

.chart-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.chart-bar {
  width: 70%;
  max-width: 40px;
  min-height: 3px;
  background: var(--admin-accent);
  border-radius: 5px 5px 0 0;
}

.chart-label {
  color: var(--admin-muted);
  font-size: 11px;
}

/* NOTIFICACIONES */

.notification {
  padding: 16px;
  border-bottom: 1px solid var(--admin-border);
}

.notification.unread {
  background: #f0f7f6;
  border-left: 3px solid var(--admin-accent);
}

.notification small {
  color: var(--admin-muted);
}

/* CONFIGURACION */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.form-group {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 16px 0;
  border-bottom: 1px solid var(--admin-border);
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--admin-accent);
}

/* VENTANAS DE DETALLE */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #172c3980;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 15px 50px #00000025;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.empty-state {
  text-align: center;
  padding: 35px 15px;
  color: var(--admin-muted);
}

#panel-message {
  color: var(--admin-accent);
  font-size: 13px;
  overflow-wrap: anywhere;
}

#panel-message:empty {
  display: none;
}

.mobile-menu {
  display: none;
}

/* ADAPTACION A TABLETS */

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .admin-main {
    padding: 22px;
  }
}

/* ADAPTACION A CELULARES */

@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -270px;
    width: 250px;
    height: 100dvh;
    z-index: 90;
    transition: left .25s ease;
    box-shadow: 8px 0 30px #00000020;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .admin-main {
    padding: 16px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-value {
    font-size: 23px;
  }

  .admin-card {
    padding: 15px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .auth-container {
    margin: 35px auto;
  }

  .auth-card {
    padding: 24px;
  }

  .stock-row {
    flex-wrap: wrap;
  }

  .filters {
    flex-direction: column;
  }

  .filters input, .filters select {
    width: 100%;
  }
}
