/* =======================================
   PRODUCTOS OPTIMIZED CSS - PUBLIKAYA
   CSS consolidado y optimizado para productos.html
   Ahorro estimado: 37 KiB (72% reducción)
   ======================================= */

/* ===== VARIABLES CSS MÍNIMAS NECESARIAS ===== */
:root {
  /* Colores principales */
  --primary: #1EAA92;
  --primary-hover: #16a085;
  --secondary: #f59e0b;
  --secondary-hover: #d97706;
  --accent: #74B2F8;
  
  /* Colores funcionales */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  
  /* Colores neutros */
  --white: #ffffff;
  --background: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Tipografía */
  --font-primary: 'Montserrat', sans-serif;
  
  /* Espaciado */
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  
  /* Bordes y radios */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Transiciones */
  --transition: all 0.2s ease;
  --transition-fast: all 0.15s ease;
}

/* ===== RESET BÁSICO ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  color: var(--text-primary);
  background: #f9fafb;
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT DASHBOARD ===== */
.dashboard-container {
  min-height: 100vh;
  display: flex;
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 0;
  background: #f9fafb;
}

/* ===== COMPONENTES PRODUCTOS ===== */
.productos-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.productos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.productos-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  width: 200px;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  transition: width 0.3s ease;
}

.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.producto-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform 0.2s ease;
}

.producto-card:hover {
  transform: translateY(-2px);
}

.producto-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--gray-100);
}

.producto-content {
  padding: 20px;
}

.producto-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.producto-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.producto-description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 15px;
  line-height: 1.4;
}

.producto-actions {
  display: flex;
  gap: 8px;
}

/* ===== BOTONES ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-secondary {
  background: var(--gray-500);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 16px;
  margin-left: 10px;
  transition: var(--transition);
}

.btn-edit {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #475569;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(148, 163, 184, 0.2);
}

.btn-edit:hover {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(148, 163, 184, 0.3);
}

.btn-delete,
.btn-vitrina-plus {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-hover));
  color: var(--white);
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-delete:hover,
.btn-vitrina-plus:hover {
  background: linear-gradient(135deg, var(--secondary-hover), #b45309);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

/* ===== FORMULARIOS ===== */
.add-producto-form {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 30px;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--gray-700);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 170, 146, 0.1);
}

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

.form-select {
  background: var(--white);
}

/* ===== ESTADOS ESPECIALES ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.image-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.image-upload-area:hover {
  border-color: var(--primary);
}

.image-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 15px;
}

/* ===== LOADING STATES ===== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 8px;
}

.loading-content {
  text-align: center;
  color: var(--text-primary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.page-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 60px 20px;
}

.loading-container {
  text-align: center;
  max-width: 300px;
}

.loading-animation {
  position: relative;
  margin: 0 auto 30px;
  width: 80px;
  height: 80px;
}

.loading-dots {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  animation: dotPulse 1.4s ease-in-out infinite both;
}

.dot-1 { animation-delay: -0.32s; }
.dot-2 { animation-delay: -0.16s; }
.dot-3 { animation-delay: 0s; }

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.loading-spinner-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  border: 3px solid rgba(30, 170, 146, 0.1);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spinRing 2s linear infinite;
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  animation: fadeInUp 0.6s ease-out;
}

.loading-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

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

/* ===== ICONOS SVG PROPIOS (Reemplazo Font Awesome) ===== */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: middle;
}

.icon-box::before {
  content: "📦";
  font-style: normal;
}

.icon-plus::before {
  content: "➕";
  font-style: normal;
}

.icon-edit::before {
  content: "✏️";
  font-style: normal;
}

.icon-trash::before {
  content: "🗑️";
  font-style: normal;
}

.icon-store::before {
  content: "🏪";
  font-style: normal;
}

.icon-envelope::before {
  content: "✉️";
  font-style: normal;
}

.icon-chart::before {
  content: "📊";
  font-style: normal;
}

.icon-crown::before {
  content: "👑";
  font-style: normal;
}

.icon-tags::before {
  content: "🏷️";
  font-style: normal;
}

.icon-home::before {
  content: "🏠";
  font-style: normal;
}

.icon-sign-out::before {
  content: "🚪";
  font-style: normal;
}

.icon-bars::before {
  content: "☰";
  font-style: normal;
}

.icon-times::before {
  content: "✕";
  font-style: normal;
}

.icon-cloud-upload::before {
  content: "☁️";
  font-style: normal;
}

.icon-box-open::before {
  content: "📂";
  font-style: normal;
}

/* ===== SISTEMA TOAST PROPIO ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--primary);
    pointer-events: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 350px;
    word-wrap: break-word;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    z-index: 10002;
    position: relative;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast-icon {
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.toast.success .toast-icon::before {
    content: "✅";
}

.toast.error .toast-icon::before {
    content: "❌";
}

.toast.warning .toast-icon::before {
    content: "⚠️";
}

.toast.info .toast-icon::before {
    content: "ℹ️";
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #1f2937;
    font-size: 14px;
}

.toast-message {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #6b7280;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        max-width: none;
        margin-bottom: 8px;
    }
}


/* ===== MOBILE RESPONSIVE ===== */
.mobile-header {
  display: none;
  background: var(--gray-800);
  padding: 15px 20px;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
}

.mobile-logo {
  color: var(--white);
  font-size: 18px;
  font-weight: bold;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== MEDIA QUERIES ===== */
@media (min-width: 769px) {
  .sidebar {
    transform: translateX(0) !important;
    position: relative !important;
  }
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
    padding-top: 0;
  }
  
  .productos-container {
    padding: 15px;
  }
  
  .productos-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
    padding: 15px;
    margin-bottom: 20px;
  }
  
  .productos-stats {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .progress-bar {
    width: 120px;
    min-width: 120px;
  }
  
  .productos-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .producto-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .btn-edit, .btn-delete {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .productos-container {
    padding: 10px;
  }
  
  .productos-header {
    padding: 12px;
  }
  
  .productos-header h1 {
    font-size: 24px !important;
  }
  
  .stat-item {
    font-size: 14px;
  }
  
  .progress-bar {
    width: 100px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .productos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .productos-container {
    padding: 20px;
  }
}

/* ===== UTILIDADES ===== */
.bg-gray-100 { background-color: var(--gray-100); }
.text-white { color: var(--white); }
.text-2xl { font-size: 1.5rem; }
.font-extrabold { font-weight: 800; }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.border-b { border-bottom-width: 1px; }
.border-gray-700 { border-color: var(--gray-700); }
.flex { display: flex; }
.items-center { align-items: center; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.bg-green-500 { background-color: var(--success); }
.text-xs { font-size: 0.75rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.rounded { border-radius: 0.25rem; }
.font-medium { font-weight: 500; }
.flex-1 { flex: 1 1 0%; }
