/* Panel de administración local de Ancrismaq. Estilos propios (no dependen de la web pública). */
:root {
  --primary: #FF7A00;
  --primary-hover: #E66E00;
  --secondary: #121212;
  --text-main: #1A1A1A;
  --text-muted: #666666;
  --white: #FFFFFF;
  --transition-fast: 0.2s ease;
}
* { box-sizing: border-box; padding: 0; margin: 0; }
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text-main); line-height: 1.5; background: #f4f5f7; }
h1, h2, h3, h4 { font-weight: 700; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
.admin-shell {
  min-height: 100vh;
  background: #f4f5f7;
  display: flex;
}

.admin-sidebar {
  width: 230px;
  background: var(--secondary);
  color: white;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}

.admin-sidebar h2 {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-sidebar nav a {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.admin-sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.admin-sidebar .admin-user {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  opacity: 0.7;
}

.admin-sidebar form button {
  margin-top: 0.75rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
}

.admin-main {
  flex: 1;
  padding: 2.5rem;
  max-width: 1100px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-header h1 {
  font-size: 1.5rem;
}

.admin-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.admin-search input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.admin-search button,
.admin-btn {
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 0.9rem;
}

.admin-btn.secondary {
  background: #e5e5e5;
  color: var(--text-main);
}

.admin-btn.danger {
  background: #dc2626;
}

.admin-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.admin-table th {
  background: #fafafa;
  font-weight: 600;
  color: var(--text-muted);
}

.admin-table img {
  border-radius: 6px;
  object-fit: contain;
  background: #f4f4f4;
}

.admin-pagination {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.admin-pagination a,
.admin-pagination span {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 0.85rem;
}

.admin-pagination .active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 640px;
}

.admin-form label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.admin-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.35rem;
}

.admin-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-badge.visible {
  background: #dcfce7;
  color: #166534;
}

.admin-badge.hidden {
  background: #fee2e2;
  color: #991b1b;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 18, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: admin-modal-fade-in 0.15s ease-out;
}

.admin-modal {
  background: white;
  border-radius: 14px;
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  animation: admin-modal-scale-in 0.15s ease-out;
}

.admin-modal h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.admin-modal p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@keyframes admin-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes admin-modal-scale-in {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-family: inherit;
}

.admin-form textarea {
  min-height: 140px;
  resize: vertical;
}

.admin-spec-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-spec-row input {
  flex: 1;
}

.admin-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.admin-success {
  background: #dcfce7;
  color: #166534;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
}

.admin-login-card {
  background: white;
  padding: 2.5rem;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
}

.admin-login-card h1 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.admin-stat-card strong {
  display: block;
  font-size: 1.8rem;
  color: var(--primary);
}

.admin-stat-card span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.admin-thumb-current {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: #f4f4f4;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

/* Mensajes de contacto */
.admin-badge.quote {
  background: #ffedd5;
  color: #9a3412;
}

.admin-msg-preview {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.admin-msg-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-msg-meta dt {
  font-weight: 600;
  color: var(--text-muted);
}

.admin-msg-meta a {
  color: var(--primary);
}

.admin-msg-title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.admin-msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

/* Casilla "producto destacado" del formulario de producto */
.admin-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}

.admin-check input {
  width: auto;
  accent-color: var(--primary);
}

/* Destacados: vista previa de la home y reordenación */
.admin-featured-intro {
  margin-bottom: 1rem;
}

.admin-featured-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.admin-featured-status {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.admin-featured-status.saved {
  color: #166534;
}

.admin-featured-status.error {
  color: #b91c1c;
}

.admin-warning {
  background: #fef3c7;
  color: #92400e;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* Marco de la vista previa: la home se maqueta a 1280 px y se escala para que quepa */
.admin-featured-frame {
  position: relative;
  overflow: hidden;
  background: var(--bg-main);
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  margin-bottom: 2rem;
}

.admin-featured-canvas {
  transform-origin: top left;
  padding: 3rem 0;
}

.admin-featured-slot {
  position: relative;
  cursor: grab;
  border-radius: 12px;
  transition: opacity 0.15s ease, outline-color 0.15s ease;
  outline: 3px solid transparent;
  outline-offset: 4px;
}

.admin-featured-slot.dragging {
  opacity: 0.35;
}

.admin-featured-slot.over {
  outline-color: var(--primary);
}

.admin-featured-slot.is-hidden .admin-featured-card {
  opacity: 0.45;
}

/* La tarjeta es de muestra: sin clics ni animación de entrada */
.admin-featured-card {
  height: 100%;
  pointer-events: none;
}

.admin-featured-card .fade-in {
  animation: none;
}

.admin-featured-tools {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  z-index: 5;
}

.admin-featured-tools button,
.admin-featured-pos {
  min-width: 2.4rem;
  height: 2.4rem;
  padding: 0 0.5rem;
  border: none;
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.88);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-featured-pos {
  background: var(--primary);
  cursor: grab;
}

.admin-featured-tools button:hover:not(:disabled) {
  background: var(--primary);
}

.admin-featured-tools button.danger:hover:not(:disabled) {
  background: #dc2626;
}

.admin-featured-tools button:disabled {
  opacity: 0.35;
  cursor: default;
}

.admin-featured-hidden-note {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  z-index: 5;
}

.admin-featured-add h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
