/* ===== DESIGN SYSTEM ADMIN - DISTRIBUIDORA YAMIMAROSHA ===== */

:root {
  /* 🎨 Paleta Dorada Premium */
  --gold-primary: #d4af37;
  --gold-secondary: #f4e4a6;
  --gold-accent: #b8941f;
  --gold-dark: #8b6914;

  /* 🌟 Fondos con Gradientes */
  --bg-primary: linear-gradient(135deg, #f5f5f5 0%, #ffffff 50%, #fafafa 100%);
  --bg-secondary: radial-gradient(1200px 600px at 70% -20%, rgba(212,175,55,0.08), transparent 60%);
  --bg-card: #ffffff;
  --bg-panel: rgba(255,255,255,0.95);

  /* 📝 Texto Jerárquico */
  --text-primary: #000000;
  --text-secondary: rgba(0,0,0,0.8);
  --text-muted: rgba(0,0,0,0.6);
  --text-inverse: #ffffff;

  /* 🔮 Bordes y Estados */
  --border: rgba(0,0,0,0.1);
  --border-hover: rgba(212,175,55,0.4);
  --border-active: rgba(212,175,55,0.6);

  /* 💫 Sombras Premium */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-gold: 0 4px 20px rgba(212,175,55,0.15);

  /* 🎯 Estados Interactivos */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* 📐 Espaciado Consistente */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* 🔄 Transiciones */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== LAYOUT MODERNO CON SIDEBAR ===== */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  position: relative;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1002;
}

.menu-toggle span {
  width: 24px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-base);
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.sidebar {
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  padding: var(--space-lg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--bg-card);
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--gold-primary);
  border-radius: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--gold-primary);
}

.brand h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-primary);
}

.brand small {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.nav {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.nav a {
  padding: var(--space-sm) var(--space-md);
  border-radius: 10px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-base);
}

.nav a:hover,
.nav a.active {
  background: var(--bg-card);
  border-color: var(--border-hover);
  color: var(--gold-primary);
  transform: translateX(4px);
}

.content {
  background: transparent;
  overflow-x: hidden;
}

/* Botón toggle de menú (oculto por defecto, visible en móviles) */


.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(20px);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  color: var(--text-primary);
}

.topbar h2 {
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--gold-primary);
  text-shadow: 0 2px 8px rgba(212,175,55,0.3);
}

.topbar .actions {
  display: flex;
  gap: var(--space-sm);
}

.btn {
  padding: var(--space-sm) var(--space-md);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition-base);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.btn:hover {
  background: var(--gold-primary);
  color: var(--text-inverse);
  border-color: var(--gold-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-accent));
  color: var(--text-inverse);
  border-color: transparent;
}

.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.container {
  padding: var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
}

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

/* ===== TIPOGRAFÍA PREMIUM ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--gold-primary);
  margin: 0 0 var(--space-md) 0;
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== TARJETAS MODERNAS ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-gold);
  transform: translateY(-4px);
}

.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
}

.card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gold-primary);
}

.card-body {
  padding: var(--space-lg);
}

/* ===== FORMULARIOS PREMIUM ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-grid .full {
  grid-column: 1 / -1;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition-base);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
  background: rgba(255,255,255,0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gold-primary);
  margin-bottom: var(--space-xs);
}

/* ===== TABLAS PREMIUM ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-lg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.table th {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-accent));
  color: var(--text-inverse);
  text-align: left;
  padding: var(--space-md);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
  vertical-align: middle;
}

.table tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

.table tr:hover td {
  background: var(--bg-panel);
  color: var(--gold-primary);
  transition: all var(--transition-base);
}

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

/* ===== PRODUCTOS GRID ===== */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
}



.prod-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
}

.prod-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-gold);
  transform: translateY(-4px);
}

.prod-card .media {
  height: 240px;
  background: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.prod-card .media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: var(--space-md);
  border-radius: 12px;
}

/* ===== Vendor panel: estandarizar miniaturas ===== */
.prod-card.vendor .media {
  height: 180px; /* tamaño estándar del target */
}
.prod-card.vendor .media img {
  width: 160px;  /* miniatura consistente */
  height: 160px;
  object-fit: contain; /* mostrar imagen completa sin recortes */
  padding: 0;
  border-radius: 12px;
  background: #f3f3f3;
}

@media (max-width: 720px) {
  .prod-card.vendor .media { height: 160px; }
  .prod-card.vendor .media img { width: 140px; height: 140px; object-fit: contain; }
}

@media (max-width: 560px) {
  .prod-card.vendor .media { height: 140px; }
  .prod-card.vendor .media img { width: 120px; height: 120px; object-fit: contain; }
}

.prod-card .info {
  padding: var(--space-md);
}

.prod-card .info h4 {
  margin: 0 0 var(--space-xs) 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.prod-card .info p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.prod-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

/* ===== DROPZONE MODERNO ===== */
.dropzone {
  border: 2px dashed var(--border-hover);
  background: var(--bg-card);
  border-radius: 12px;
  padding: var(--space-2xl);
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.1), transparent);
  transition: left var(--transition-slow);
}

.dropzone:hover {
  border-color: var(--gold-primary);
  background: rgba(212,175,55,0.05);
  color: var(--gold-primary);
  transform: scale(1.02);
}

.dropzone:hover::before {
  left: 100%;
}

.dropzone.dragover {
  border-color: var(--success);
  background: rgba(34,197,94,0.1);
  color: var(--success);
  transform: scale(1.05);
}

/* ===== MODALES PREMIUM ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.3s ease-out;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  width: min(95%, 1000px);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.modal-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border-radius: 16px 16px 0 0;
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--bg-card);
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--gold-primary);
  border-radius: 2px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    z-index: 1001;
    transition: left var(--transition-base);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .products {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: var(--space-lg);
  }

  .topbar {
    padding: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .topbar .actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  /* Tablas con scroll horizontal */
  .card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 720px;
  }
}

@media (max-width: 720px) {
  .container {
    padding: var(--space-md);
  }

  .topbar {
    padding: var(--space-sm) var(--space-md);
  }

  .topbar h2 {
    font-size: 1.25rem;
    width: 100%;
  }

  .topbar .actions {
    gap: var(--space-xs);
  }

  .btn {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .products {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
  }

  .prod-card .media {
    height: 180px;
  }

  .card-header {
    padding: var(--space-sm) var(--space-md);
    flex-wrap: wrap;
  }

  .card-body {
    padding: var(--space-md);
  }

  .modal-dialog {
    width: 95%;
    margin: var(--space-sm);
  }

  .form-grid {
    gap: var(--space-sm);
  }

  input, select, textarea {
    font-size: 0.9rem;
  }
}

@media (max-width: 560px) {
  .products {
    grid-template-columns: 1fr;
  }

  .topbar .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar .actions .btn {
    width: 100%;
    justify-content: center;
  }

  .card-title {
    font-size: 1rem;
  }

  .prod-card .media {
    height: 160px;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

/* ===== PRODUCT CARDS (estilo tienda) ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.product-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}

.product-card .thumb {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.95);
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.product-card h4 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 600;
}

.product-card .desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
  line-height: 1.4;
  flex: 1;
}

.product-card .price {
  color: var(--gold-primary);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.product-card .actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.product-card .btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.9rem;
}

.product-card .btn.danger {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.product-card .btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}