/* === PALETA CMYK === */
:root {
  --cian: #00bfff;
  --magenta: #ff007f;
  --amarillo: #ffd700;
  --negro: #1a1a1a;
  --blanco: #ffffff;
  --gris-claro: #f5f6fa;
  --gris-borde: #e0e0e0;
  --verde-exito: #28a745;
  --rojo-error: #dc3545;
  --amarillo-adv: #ffc107;
  --borde-radio: 10px;
  --sombra: 0 6px 14px rgba(0, 0, 0, 0.1);
  --transicion-rapida: all 0.2s ease-in-out;
}

/* --- ESTILOS PARA LA SECCIÓN CORTE DE CAJA --- */

.corte-summary-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    max-width: 600px;
}

.corte-summary-card h3 {
    margin-top: 0;
}

/* Estilo para cada tarjeta de venta individual en el corte */
.corte-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden; /* Para que el header redondeado se vea bien */
}

/* El encabezado de la tarjeta (Nota y Cliente) */
.corte-card-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    background-color: #f9f9f9;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}

/* El cuerpo de la tarjeta, dividido en 3 columnas */
.corte-card-body {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr; /* Descripción más ancha */
    gap: 1rem;
    padding: 1rem;
}

.corte-description ul {
    margin-top: 5px;
    padding-left: 20px;
    font-size: 0.9em;
    color: #555;
}

.corte-payment p, .corte-resta p {
    margin: 5px 0;
}

/* Clases para los chips de estado (Efectivo/Transferencia) */
.chip {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    display: inline-block;
}

.chip-success {
    background-color: #e8f5e9; /* Verde claro */
    color: #2e7d32; /* Verde oscuro */
}

.chip-neutral {
    background-color: #f3f4f6; /* Gris claro */
    color: #4b5563; /* Gris oscuro */
}

/* --- ESTILOS PARA EL NUEVO CALENDARIO --- */

/* Contenedor principal del calendario en la sección */
#calendario-entregas {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* El header donde van "Lun, Mar, Mié..." */
.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* 7 columnas iguales */
    gap: 5px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.calendar-header div {
    text-align: center;
    font-weight: bold;
    color: #555;
}

/* El body donde van los números de los días */
.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* 7 columnas iguales, LA REGLA CLAVE */
    gap: 8px; /* Espacio entre los días */
}

/* Estilo base para cada día del calendario */
.calendar-day {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    height: 60px; /* Altura fija para que sean cuadrados */
    text-align: center;
    border-radius: 6px;
    cursor: default;
    transition: background-color 0.2s;
    position: relative; /* Para posicionar el contador de entregas */
}

/* Estilo para el día de hoy */
.calendar-day.is-today {
    background-color: #fffde7; /* Un amarillo suave */
    border: 1px solid #fbc02d;
    font-weight: bold;
}

/* Estilo para un día que TIENE una entrega */
.calendar-day.has-delivery {
    background-color: #fce4ec; /* Un rosado suave */
    font-weight: bold;
    cursor: pointer;
    border: 1px solid #f06292;
}

/* Efecto hover para los días con entregas */
.calendar-day.has-delivery:hover {
    background-color: #f8bbd0;
    transform: scale(1.05);
}

/* El circulito que muestra el número de entregas */
.calendar-day span {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #0066cc;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.8em;
    line-height: 20px; /* Centra el número verticalmente */
    text-align: center;
}

/* === CLASES DE UTILIDAD === */
.hidden { display: none !important; }

/* === BASE === */
body {
  margin: 0;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--gris-claro);
  color: var(--negro);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === LOGIN === */
.center-screen { display: flex; justify-content: center; align-items: center; height: 100vh; }
.login-card { background: var(--blanco); padding: 40px; border-radius: var(--borde-radio); box-shadow: var(--sombra); width: 100%; max-width: 400px; }
.login-card h1 { color: var(--cian); text-align: center; border-bottom: 3px solid var(--amarillo); padding-bottom: 10px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input { padding: 10px; border: 1px solid #ccc; border-radius: var(--borde-radio); font-size: 1em; }
.login-card button { background-color: var(--cian); color: var(--blanco); padding: 10px; border: none; border-radius: var(--borde-radio); cursor: pointer; font-weight: 600; transition: var(--transicion-rapida); }
.login-card button:hover { background-color: var(--magenta); transform: translateY(-2px); }
.error-message { color: var(--magenta); text-align: center; font-weight: 500; }

/* === DASHBOARD LAYOUT === */
#main-content { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 250px; background-color: var(--negro); color: var(--blanco); display: flex; flex-direction: column; justify-content: space-between; box-shadow: 3px 0 10px rgba(0,0,0,0.2); flex-shrink: 0; }
.sidebar .brand { font-size: 1.2em; font-weight: 700; text-align: center; padding: 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
.sidebar nav { display: flex; flex-direction: column; padding: 10px; gap: 10px; }
.sidebar nav button { background: none; border: none; color: var(--blanco); font-size: 1em; text-align: left; padding: 12px 20px; border-radius: var(--borde-radio); transition: var(--transicion-rapida); cursor: pointer; }
.sidebar nav button:hover { background: var(--magenta); transform: translateX(3px); }
.sidebar nav button.active { background: var(--magenta); font-weight: 700; transform: translateX(3px); }
.sidebar-footer { padding: 20px; border-top: 1px solid rgba(255, 255, 255, 0.2); }
.main-area { flex-grow: 1; overflow-y: auto; padding: 40px 50px; background-color: var(--gris-claro); }
h1 { color: var(--cian); font-size: 2em; border-bottom: 4px solid var(--amarillo); padding-bottom: 10px; margin-top: 0; margin-bottom: 30px; }

/* === PANELES, FORMULARIOS Y BOTONES === */
.panels { display: flex; gap: 25px; margin-bottom: 30px; flex-wrap: wrap; }
.panel-card { flex: 1; background: var(--blanco); border-radius: var(--borde-radio); box-shadow: var(--sombra); padding: 25px; min-width: 280px; transition: var(--transicion-rapida); }
.panel-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.panel-card h2 { margin-top: 0; color: var(--negro); }
form label { font-weight: 600; display: block; margin-bottom: 5px; }
.inline-label { display: flex; align-items: center; gap: 8px; font-weight: normal; margin: 10px 0; }
.inline-label input { width: auto; }
input:not([type="checkbox"]), select { width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: var(--borde-radio); font-size: 1em; box-sizing: border-box; transition: var(--transicion-rapida); }
input:focus, select:focus { border-color: var(--cian); box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.2); outline: none; }
fieldset { background: var(--blanco); border: none; padding: 25px; margin-bottom: 25px; border-radius: var(--borde-radio); box-shadow: var(--sombra); }
legend { color: var(--magenta); font-weight: 700; font-size: 1.1em; padding: 0 5px; }
fieldset.datos-cliente { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.totales-diseno { display: flex; flex-wrap: wrap; gap: 30px; }
.totales-diseno > div { flex: 1; min-width: 250px; }
button { background: var(--cian); color: var(--blanco); border: none; border-radius: var(--borde-radio); padding: 10px 18px; cursor: pointer; font-weight: 600; transition: var(--transicion-rapida); }
button:hover { background: var(--magenta); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
button:active { transform: translateY(0) scale(0.98); }
.submit-btn { width: 100%; background: var(--magenta); margin-top: 15px; padding: 12px; font-size: 1.1em; }
.secondary-btn { background: #6c757d; color: #fff; }
.secondary-btn:hover { background: #5a6268; }
.toolbar { display: flex; flex-wrap: wrap; gap: 15px; align-items: center; margin-bottom: 20px; background-color: var(--blanco); padding: 15px; border-radius: var(--borde-radio); box-shadow: var(--sombra); }
.toolbar input, .toolbar select, .toolbar button { width: auto; }

/* === MEJORA: NOTIFICACIONES TOAST === */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 15px 20px; color: var(--blanco); border-radius: var(--borde-radio); box-shadow: var(--sombra); font-weight: 600; min-width: 250px; opacity: 0; transform: translateX(100%); animation: slideIn 0.5s forwards; }
.toast.success { background-color: var(--verde-exito); }
.toast.error { background-color: var(--rojo-error); }
.toast.warning { background-color: var(--amarillo-adv); color: var(--negro); }
.toast.info { background-color: var(--cian); }
.toast.fade-out { animation: slideOut 0.5s forwards; }
@keyframes slideIn { to { opacity: 1; transform: translateX(0); } }
@keyframes slideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* === MEJORA: SKELETON LOADERS === */
.skeleton { background: #e0e0e0; border-radius: 4px; position: relative; overflow: hidden; }
.skeleton::after { content: ''; position: absolute; top: 0; left: -150%; width: 150%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent); animation: shimmer 1.5s infinite; }
.skeleton-text { width: 100%; height: 1em; margin-bottom: 0.5em; }
.skeleton-title { width: 50%; height: 1.5em; margin-bottom: 1em; }
.skeleton-card .skeleton-title { height: 2em; width: 60%; }
.skeleton-card .skeleton-text { height: 1.2em; margin-bottom: 0.8em; }
@keyframes shimmer { 100% { left: 150%; } }

/* === MEJORA: CHIPS DE ESTADO === */
.chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 16px; font-weight: 600; font-size: 0.85em; }
.chip-success { background-color: #d4edda; color: #155724; }
.chip-pending { background-color: #fff3cd; color: #856404; }
.chip-overdue { background-color: #f8d7da; color: #721c24; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); } }

/* === MEJORA: ESTADOS VACÍOS ILUSTRADOS === */
.empty-state { text-align: center; padding: 40px; }
.empty-state svg { width: 120px; height: 120px; margin-bottom: 20px; opacity: 0.7; }
.empty-state h3 { font-size: 1.5em; color: #555; }
.empty-state p { color: #777; }

/* === TABLAS === */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--blanco); border-radius: var(--borde-radio); overflow: hidden; box-shadow: var(--sombra); }
th { background: var(--negro); color: var(--blanco); padding: 12px; text-align: left; font-weight: 600; }
td { padding: 10px; border-bottom: 1px solid var(--gris-borde); vertical-align: middle; }
tbody tr { transition: background-color 0.15s ease-in-out; }
tbody tr:nth-child(even) { background: #fafafa; }
tbody tr:hover { background: #eef9ff; }
#productos-table .input-cantidad { width: 60px; }
#productos-table .input-importe { width: 100px; }
#productos-table .remove-product-btn { background-color: #dc3545; padding: 6px 10px; }

/* === MODAL & OTROS === */
#modal-detalle { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 1000; padding: 20px; box-sizing: border-box; }
.modal-content { background: white; padding: 25px; border-radius: var(--borde-radio); max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; }
.total-final, .resta-final { font-weight: 700; color: var(--magenta); font-size: 1.2em; }
.corte-summary-card { background: var(--blanco); border-left: 5px solid var(--cian); padding: 20px; margin-bottom: 20px; border-radius: var(--borde-radio); box-shadow: var(--sombra); }
.corte-summary-card p { margin: 10px 0; font-size: 1.1em; }
.corte-summary-card .total-final { font-size: 1.4em; color: green; }
.calendar-day { transition: all 0.2s; border-radius: 6px; border: 1px solid var(--gris-borde) !important; }
.calendar-day:hover { background-color: var(--amarillo) !important; transform: scale(1.05); }

/* === RESPONSIVE & MENÚ MÓVIL === */
.mobile-header, .bottom-nav { display: none; }

@media (max-width: 900px) {
  body { padding-bottom: 80px; } /* Espacio para el bottom nav */
  #main-content { flex-direction: column; height: auto; overflow: visible; }
  .main-area { padding: 20px; }
  .mobile-header { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; padding: 10px; background: var(--blanco); border-radius: var(--borde-radio); box-shadow: var(--sombra); }
  #mobile-menu-btn { background: none; border: none; font-size: 1.8em; padding: 0; color: var(--negro); }
  #mobile-header-title { font-size: 1.2em; font-weight: 600; }
  .sidebar { position: fixed; top: 0; left: -100%; width: 260px; height: 100vh; z-index: 1001; transition: left 0.3s ease-in-out; border-right: 2px solid var(--magenta); }
  .sidebar.visible { left: 0; }
  /* MEJORA: Overlay para menú móvil */
  body.menu-open::after { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; }
  .panels { flex-direction: column; }
  
  /* MEJORA: BARRA DE NAVEGACIÓN INFERIOR */
  .bottom-nav { display: flex; justify-content: space-around; align-items: center; position: fixed; bottom: 0; left: 0; width: 100%; height: 65px; background: var(--blanco); box-shadow: 0 -2px 10px rgba(0,0,0,0.1); z-index: 900; }
  .bottom-nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; border: none; color: #888; flex-grow: 1; padding: 5px 0; gap: 4px; font-size: 0.75rem; transition: color 0.2s; }
  .bottom-nav-btn .icon { font-size: 1.5rem; }
  .bottom-nav-btn.active { color: var(--magenta); }
  .fab { background: var(--magenta); color: var(--blanco); border: none; border-radius: 50%; width: 60px; height: 60px; display: flex; justify-content: center; align-items: center; font-size: 2rem; box-shadow: 0 4px 12px rgba(255, 0, 127, 0.4); transform: translateY(-20px); transition: transform 0.2s; }
  .fab:active { transform: translateY(-20px) scale(0.95); }

  /* ESTILOS PARA TABLAS RESPONSIVAS */
  .responsive-table thead { display: none; }
  .responsive-table tr, .responsive-table tbody tr { display: block; margin-bottom: 15px; }
  .responsive-table td { display: block; text-align: right; position: relative; padding-left: 50%; border-bottom: 1px dotted var(--gris-borde); }
  #sales-history-table td { padding: 12px 8px; }
  .responsive-table td:last-child { border-bottom: none; }
  .responsive-table td::before { content: attr(data-label); position: absolute; left: 10px; width: 45%; padding-right: 10px; font-weight: bold; text-align: left; }
}

/* ... (Estilos anteriores sin cambios) ... */

/* === MEJORA: ESTILOS PARA MANEJO DE IMÁGENES === */
.diseno {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#diseno-drop-zone {
  border: 3px dashed var(--gris-borde);
  border-radius: var(--borde-radio);
  padding: 30px;
  text-align: center;
  color: #888;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

#diseno-drop-zone.dragover {
  border-color: var(--magenta);
  background-color: #ffeff7;
  transform: scale(1.02);
}

#diseno-drop-zone p {
  margin: 0;
  font-weight: 500;
}

.image-actions {
  display: flex;
  justify-content: center;
}

#thumbnail-preview-container {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #f9f9f9;
  border: 1px solid var(--gris-borde);
  border-radius: var(--borde-radio);
  padding: 10px;
}

#thumbnail-preview {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--blanco);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.thumbnail-info {
  font-size: 0.9em;
}

.thumbnail-info p {
  margin: 0 0 5px 0;
}

#thumbnail-filename {
  font-weight: bold;
  word-break: break-all;
}

#thumbnail-compression-info {
  color: var(--verde-exito);
  font-weight: 600;
}

#remove-image-btn {
  background-color: transparent;
  color: var(--rojo-error);
  padding: 2px 5px;
  font-size: 0.8em;
  font-weight: bold;
}
#remove-image-btn:hover {
  background-color: var(--rojo-error);
  color: var(--blanco);
}

/* === MEJORA: ESTILOS PARA MODAL DE PREVIEW === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1500;
  padding: 20px;
  box-sizing: border-box;
}

#image-preview-modal .modal-content {
  background: white;
  padding: 25px;
  border-radius: var(--borde-radio);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#full-preview-image {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 6px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

/* ... (Resto de los estilos sin cambios) ... */