/* ============================================================
   HUERTO ORIENTE — admin.css
   Estilos del panel de administración (solo lo ve el administrador).
   Índice:
     1. Botón "Panel" y numerito de pedidos nuevos
     2. Ventana del panel y pestañas
     3. Pedidos: filtros, tarjetas y botones de estado
     4. Clientes: formulario y lista
   ============================================================ */

/* ---------- 1. Botón "Panel" y numerito ---------- */
.admin-badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  background: #d9482b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}
.admin-badge[hidden] { display: none; }


/* ---------- 2. Ventana del panel y pestañas ---------- */
.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 12, 8, 0.7);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.admin-overlay.open { opacity: 1; pointer-events: auto; }

.admin-panel {
  width: 100%;
  max-width: 860px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.adm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.75rem;
  border-bottom: 1px solid var(--line);
}
.adm-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.45rem; }
.adm-cerrar {
  background: none;
  border: none;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
.adm-cerrar:hover { color: var(--accent); }

.adm-tabs { display: flex; gap: 0.25rem; padding: 0 1.75rem; border-bottom: 1px solid var(--line); }
.adm-tab {
  padding: 0.8rem 1rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.adm-tab.activo { color: var(--ink); border-bottom-color: #4f9a4d; }

.adm-cuerpo { padding: 1.25rem 1.75rem 1.75rem; overflow-y: auto; }
.adm-cuerpo [hidden] { display: none; }
.adm-lista { display: flex; flex-direction: column; gap: 1rem; }
.adm-vacio { padding: 2.5rem 0; text-align: center; color: var(--muted); }


/* ---------- 3. Pedidos ---------- */
.adm-filtros { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.1rem; }
.adm-filtro {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-family: var(--body);
  font-size: 0.85rem;
  cursor: pointer;
}
.adm-filtro span { margin-left: 0.25rem; color: var(--muted); font-weight: 700; }
.adm-filtro.activo { background: #3f7a3d; border-color: #3f7a3d; color: #fff; }
.adm-filtro.activo span { color: #d6f0cf; }

.adm-pedido {
  padding: 1.1rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 7px solid var(--color-cliente, #546e7a);   /* barra del color del cliente */
  border-radius: 10px;
}
.adm-pedido-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.8rem;
}
.adm-titulo { display: flex; align-items: center; gap: 0.6rem; }
/* Nombre del cliente sobre su color: así se distinguen de un vistazo (Pedido 1 y 2 comparten color) */
.adm-chifa {
  padding: 0.15rem 0.8rem;
  font-family: var(--display);
  font-size: 1.15rem;
  color: #fff;
  background: var(--color-cliente, #546e7a);
  border-radius: 6px;
}
/* Etiqueta "Pedido 1" / "Pedido 2" (el 2 resalta para no confundirlo con el primero) */
.adm-numero {
  padding: 0.1rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.07);
  border-radius: 999px;
}
.adm-numero-2 { color: #fff; background: #d9482b; }
.adm-fecha { color: var(--muted); font-size: 0.85rem; }

.adm-lineas { display: flex; flex-direction: column; gap: 0.45rem; }
.adm-linea {
  display: grid;
  grid-template-columns: 1.4rem 40px 1fr auto;
  align-items: center;
  gap: 0.75rem;
}
.adm-linea img {
  width: 40px; height: 40px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.adm-linea-num { font-weight: 700; color: #d9482b; text-align: center; }
.adm-linea-nombre { font-weight: 600; }
.adm-total-items { margin-top: 0.7rem; font-size: 0.85rem; color: var(--muted); text-align: right; }
.adm-linea-cant { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

.adm-direccion {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-word;
}
.adm-direccion a { color: #2f6b2d; font-weight: 600; }

.adm-mensaje {
  margin-top: 0.7rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  background: rgba(217, 162, 27, 0.16);
  border-left: 3px solid #d9a21b;
  border-radius: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

.adm-estados { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.adm-estado {
  flex: 1 1 120px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.adm-estado:hover:not(.activo) { background: var(--line); }
.adm-estado:disabled { opacity: 0.6; cursor: wait; }
.adm-estado.activo { cursor: default; color: #fff; border-color: transparent; }
.adm-estado.estado-recibido     { background: #c8543d; }
.adm-estado.estado-empaquetando { background: #2f6fb0; }
.adm-estado.estado-listo        { background: #3f7a3d; }


/* ---------- 4. Clientes ---------- */
.adm-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.adm-form h3, .adm-subtitulo { font-family: var(--display); font-weight: 500; font-size: 1.15rem; }
.adm-subtitulo { margin: 1.5rem 0 0.8rem; }
.adm-form label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.adm-form input {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--body);
  font-size: 1rem;
}
.adm-form input:focus { outline: 1px solid #4f9a4d; }

.adm-crear {
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: none;
  border-radius: 8px;
  background: #3f7a3d;
  color: #fff;
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.adm-crear:hover { background: #4f9a4d; }
.adm-crear:disabled { opacity: 0.6; cursor: wait; }

.adm-resultado { display: none; margin-top: 0.8rem; padding: 0.75rem 0.9rem; border-radius: 8px; font-size: 0.9rem; }
.adm-resultado.ok    { display: block; background: rgba(79, 154, 77, 0.12); border-left: 3px solid #4f9a4d; }
.adm-resultado.error { display: block; background: rgba(200, 84, 61, 0.12); border-left: 3px solid #c8543d; }
.adm-copiar {
  display: block;
  margin-top: 0.6rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid #4f9a4d;
  border-radius: 6px;
  background: #fff;
  color: #2f6b2d;
  font-family: var(--body);
  font-weight: 600;
  cursor: pointer;
}

.adm-cliente {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 7px solid var(--color-cliente, #546e7a);   /* mismo color que en Pedidos */
  border-radius: 8px;
}
.adm-cliente span { color: var(--muted); font-size: 0.85rem; margin-left: auto; }
.adm-eliminar {
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-family: var(--body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.adm-eliminar:hover { background: #c0392b; color: #fff; }
.adm-eliminar:disabled { opacity: 0.5; cursor: default; }


@media (max-width: 600px) {
  .adm-head, .adm-tabs, .adm-cuerpo { padding-left: 1rem; padding-right: 1rem; }
}