/* =========================================================
   PANEL DE BODEGA & ADMINISTRACIÓN — STONE CRYSTAL
   Estilos limpios, funcionales y optimizados con identidad oficial
   ========================================================= */

:root {
  --bg-dark: #F8F7F4;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAF9F6;
  --border: #E2DDD3;
  --border-light: #ECE8E0;
  
  --jade-primary: #4D7F71;
  --jade-forest: #36563D;
  --jade-deep: #25402D;
  
  --gold: #8C704E;
  --gold-light: #8C704E;
  --gold-dark: #6D5438;
  
  --text: #202A26;
  --text-muted: #5C6A64;
  --text-dim: #8B9892;
  
  --green: #22c55e;
  --red: #ef4444;
  --blue: #36563D;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --font-family: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-family);
  line-height: 1.5;
  min-height: 100vh;
}

/* Pantalla de Login */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(44, 79, 62, 0.08);
}

.login-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--jade-forest), var(--jade-deep));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 16px;
  color: #FFFFFF;
}

.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: 6px;
  color: var(--text);
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #FFFFFF;
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--jade-forest);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--jade-forest), var(--jade-deep));
  color: #FFFFFF;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(54, 86, 61, 0.25);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Panel Principal (Admin Dashboard) */
.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-nav {
  background: #FFFFFF;
  border-bottom: 1.5px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(44, 79, 62, 0.05);
}

.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--jade-forest);
}

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-secondary {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: #FFFFFF;
  border-color: var(--jade-forest);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
}

/* Navegación por Pestañas */
.tabs-header {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 14px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--jade-forest);
}

.tab-btn.active {
  color: var(--jade-forest);
  border-bottom-color: var(--jade-forest);
}

/* Contenido Principal */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  width: 100%;
}

/* Tarjetas de Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold-light);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Barra de Acciones de la Sección */
.section-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.toolbar-search {
  flex: 1;
  min-width: 240px;
  max-width: 400px;
}

/* Tablas */
.table-responsive {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: var(--bg-surface);
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover {
  background: var(--bg-card-hover);
}

.table-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #171513;
  display: block;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.btn-action-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-action-icon:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-action-icon.delete:hover {
  border-color: var(--red);
  color: var(--red);
}

/* Zona de Carga Masiva (Drag & Drop) */
.dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dropzone-help {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Progress bar */
.progress-container {
  margin-top: 16px;
  display: none;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--green));
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* Modales Admin */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.admin-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.admin-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-modal-body {
  padding: 20px;
}

.admin-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Image Preview in Modal */
.image-preview-box {
  width: 100%;
  height: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 12px;
}

.image-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Modal y Galería de Fotos por Producto */
.admin-modal.gallery-modal {
  max-width: 720px;
}

.gallery-dropzone {
  border: 2px dashed var(--jade-primary);
  border-radius: var(--radius-md);
  padding: 22px;
  text-align: center;
  background: var(--bg-card-hover);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 20px;
}

.gallery-dropzone:hover, .gallery-dropzone.dragover {
  background: rgba(77, 127, 113, 0.08);
  border-color: var(--jade-forest);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.gallery-item {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
}

.gallery-item.is-cover {
  border: 2px solid var(--gold);
}

.gallery-item-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f0f0f0;
}

.gallery-item-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--gold);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.gallery-item-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
}

.gallery-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s;
  color: var(--text-muted);
}

.gallery-action-btn:hover {
  background: var(--border-light);
  color: var(--text);
}

.gallery-action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.badge-photo-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--jade-forest);
  background: rgba(54, 86, 61, 0.1);
  padding: 2px 6px;
  border-radius: 10px;
  margin-top: 4px;
}

/* =========================================================
   RESPONSIVE DESIGN PARA MÓVILES (Admin Panel)
   ========================================================= */
@media (max-width: 768px) {
  .admin-nav {
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .admin-nav-brand span {
    font-size: 0.95rem;
  }

  .admin-nav-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }

  .admin-nav-actions .btn-secondary,
  .admin-nav-actions .btn-danger {
    padding: 8px 10px;
    font-size: 0.78rem;
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .tabs-header {
    padding: 0 10px;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .tabs-header::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    padding: 12px 10px;
    font-size: 0.85rem;
    flex-shrink: 0;
  }

  .admin-container {
    padding: 14px 10px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px 10px;
    gap: 10px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .stat-val {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .toolbar-search {
    min-width: 100%;
    max-width: 100%;
  }

  .section-toolbar > div {
    width: 100%;
  }

  .section-toolbar button {
    width: 100% !important;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .admin-modal {
    width: calc(100% - 20px) !important;
    max-height: 92vh;
    padding: 18px 14px;
    margin: 10px;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}


