/* =========================================
   RESET & BASICS
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

.product-promotion {
    font-size: 0.85rem;
    color: #25D366;
    font-weight: 600;
    margin: 0;
}

body {
  background: #f5f7fa;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
}

.hidden { display: none !important; }
.desktop-only { display: inline; }
@media(max-width: 600px) { .desktop-only { display: none; } }

/* =========================================
   HEADER STRUCTURE
   ========================================= */
.dashboard-header {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

/* Nivel 1: Top */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #eee;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  color: #555;
  font-size: 1.2rem;
  text-decoration: none;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2b7cff;
}

.search-bar-container {
  position: relative;
  width: 50%;
  max-width: 400px;
}

.search-bar-container input {
  width: 100%;
  padding: 8px 10px 8px 35px;
  border-radius: 20px;
  border: 1px solid #ccc;
  background: #f9f9f9;
  outline: none;
}

.search-bar-container input:focus {
  border-color: #2b7cff;
  background: #fff;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
}

/* Nivel 2: Mid */
.header-mid {
  background: #f0f4f8;
  padding: 5px 15px;
  font-size: 0.85rem;
  color: #555;
  text-align: center;
}

/* Nivel 3: Tools */
.header-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: #fff;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-group { display: flex; align-items: center; gap: 8px; }

/* Selector Cliente */
.client-selector-wrapper { flex-grow: 1; max-width: 300px; }
#client-select {
  width: 100%;
  padding: 6px;
  border-radius: 5px;
  border: 1px solid #ddd;
  font-weight: bold;
  color: #333;
}

/* Botones Vista */
.btn-tool {
  background: transparent;
  border: 1px solid #ddd;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
}

.btn-tool:hover, .btn-tool.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

/* Botón Nuevo */
.btn-success {
  background: #28a745;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
}
.btn-success:hover { background: #218838; }

/* =========================================
   PANEL DE FILTROS (Lógica Mejorada)
   ========================================= */
.filter-panel {
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  padding: 10px 15px;
  animation: slideDown 0.3s ease forwards;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.input-sm {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
  background: white;
  flex: 1;
  min-width: 120px;
}

.btn-apply {
  background: #2b7cff;
  color: white;
  border: none;
  padding: 6px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.btn-apply:hover { background: #1a5fcc; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   GRID SYSTEM
   ========================================= */
.container.body-content {
  padding: 0 15px;
  max-width: 1400px;
  margin: 0 auto;
}

.productos-container {
  display: grid;
  gap: 10px;
  padding: 10px 0;
  transition: all 0.3s ease;
}

/* VISTA FULL (Defecto) */
.view-mode-full {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* VISTA NANO (MINI) - Ajustada */
.view-mode-mini {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* VISTA MICRO (LISTA) */
.view-mode-micro {
  grid-template-columns: 1fr;
}

/* =========================================
   TARJETA DE PRODUCTO (Card)
   ========================================= */
.product-result-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid #eee;
}

/* Imagen Base */
.product-image-container {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.product-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

/* Detalles Base */
.product-info-details {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.product-title {
  font-size: 1.1rem;
  color: #007185;
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

.product-desc {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price-main {
  font-size: 1.2rem;
  font-weight: bold;
  color: #b12704;
}

/* --- MODIFICADORES POR VISTA --- */

/* 1. FULL MODE */
.view-mode-full .product-image-container { height: 220px; }

/* 2. NANO/MINI MODE (Ajuste de Altura Solicitado) */
.view-mode-mini .product-info-details { 
  padding: 8px 10px; 
  text-align: center; 
  gap: 4px;
}

/* Altura mejorada para que se vea bien la imagen pero compacta */
.view-mode-mini .product-image-container { 
  height: 160px; /* Un poco más alto que 140px para mejor proporción */
} 

.view-mode-mini .product-title {
  font-size: 0.95rem;
  height: 2.6em; /* Limitar a 2 líneas exactas */
  overflow: hidden;
  margin-bottom: 5px;
}

.view-mode-mini .product-price-main {
  font-size: 1rem;
  display: block;
}

/* Ocultar elementos en Nano */
.view-mode-mini .product-desc, 
.view-mode-mini .product-meta, 
.view-mode-mini .actions,
.view-mode-mini .pd-badge-wrapper { 
  display: none; 
}

/* 3. MICRO/LIST MODE */
.view-mode-micro .product-result-card {
  flex-direction: row;
  height: 100px;
  align-items: center;
}

.view-mode-micro .product-image-container {
  width: 150px;
  height: 100%;
  border-bottom: none;
  border-right: 1px solid #eee;
}

.view-mode-micro .product-info-details {
  padding: 0 15px;
  flex-grow: 1;
  justify-content: center;
}

.view-mode-micro .product-desc,
.view-mode-micro .product-title,
.view-mode-micro .pd-badge-wrapper,
.view-mode-micro .actions { display: none; }

.view-mode-micro .product-meta { display: block; font-size: 0.8rem; }
.view-mode-micro .product-title { margin: 0; }

/* --- EXPANDED (Al hacer click en Nano/Micro) --- */
.product-result-card.expanded {
  grid-column: 1 / -1;
  flex-direction: column !important;
  height: auto !important;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transform: scale(1.01);
  border: 2px solid #007bff;
}

.product-result-card.expanded .product-image-container {
  width: 100%;
  height: 350px; /* Imagen grande al expandir */
}

.product-result-card.expanded .product-desc,
.product-result-card.expanded .product-meta,
.product-result-card.expanded .actions,
.product-result-card.expanded .pd-badge-wrapper {
  display: flex !important; /* Mostrar flex si eran flex, o block */
  flex-wrap: wrap;
}
.product-result-card.expanded .product-info-details {
  text-align: left;
  padding: 20px;
}

/* =========================================
   ELEMENTOS UI (Badges, Buttons, Toasts)
   ========================================= */

/* Badges */
.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: #333;
}

.badge {
  background-color: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.75rem;
  color: #555;
}

/* Botones de Acción Tarjeta */
.actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.btn {
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
  border-radius: 4px;
}

.actions .btn { flex: 1; padding: 8px 12px; }

.btn-edit { background-color: #fff; color: #007185; border-color: #007185; }
.btn-edit:hover { background-color: #eaf1f1; }

.btn-delete { background-color: #fff; color: #dc3545; border-color: #dc3545; }
.btn-delete:hover { background-color: #fcebeb; }

.btn-status-off { background-color: #f39c12; color: white; border-radius: 50px; border:none;}
.btn-status-on { background-color: #27ae60; color: white; border-radius: 50px; border:none;}

/* Iconos de acción (Share) */
.pd-badge-wrapper { display: flex; gap: 10px; margin-bottom: 15px; }
.action-icon-btn {
  background: none; border: none; color: #555;
  cursor: pointer; padding: 5px; font-size: 18px;
}
.action-icon-btn:hover { color: #007bff; }

/* Estado Rechazado */
.product-image-container.censored { filter: grayscale(0.8) contrast(1.2); }
.stamp-overlay {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  border: 4px solid #d32f2f; padding: 5px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #d32f2f; font-weight: bold;
  pointer-events: none; z-index: 10;
}
.integrity-alert {
  background-color: #ffebee !important; color: #c62828 !important; border: 1px solid #c62828;
}

/* Toast Notifications */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 2000; display: flex; flex-direction: column; gap: 10px;
}

.toast {
  background: #333; color: #fff;
  padding: 12px 18px; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: fadeIn 0.3s ease;
}
.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
