/* ================================================================
   MCOOP — Estilos propios
   public/assets/css/mcoop.css
   Cargado DESPUÉS de Bootstrap 5 en layout main.php y auth.php
   ================================================================ */

/* ── Paleta de marca ─────────────────────────────────────────── */
:root {
  --mc-rojo:      #D32F2F;
  --mc-rojo-dark: #B71C1C;
  --mc-azul:      #1565C0;
  --mc-azul-dark: #0D47A1;
  --mc-negro:     #1A1A1A;
  --mc-sidebar:   #111827;
  --mc-sidebar2:  #1F2937;
  --mc-bg:        #F0F2F5;
  --mc-card:      #FFFFFF;
  --mc-border:    #E5E7EB;
  --mc-text:      #374151;
  --mc-muted:     #6B7280;
  --sidebar-w:    260px;
  --topbar-h:     60px;
  --radius:       12px;
  --shadow-sm:    0 2px 8px rgba(0,0,0,.07);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
}

/* ── Reset tipográfico ───────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .9rem;
  color: var(--mc-text);
  background: var(--mc-bg);
}

/* ── Scrollbar personalizado ─────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #f1f1f1; border-radius: 3px; }
::-webkit-scrollbar-thumb  { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ── Links ───────────────────────────────────────────────────── */
a { color: var(--mc-azul); }
a:hover { color: var(--mc-azul-dark); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--mc-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  background: var(--mc-card);
  border-bottom: 1px solid var(--mc-border);
  padding: .85rem 1.25rem;
  font-weight: 700;
  font-size: .85rem;
  color: var(--mc-negro);
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

.card-footer {
  background: #FAFAFA;
  border-top: 1px solid var(--mc-border);
  border-radius: 0 0 var(--radius) var(--radius) !important;
}

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  border-radius: 8px;
  font-weight: 600;
  font-size: .845rem;
  letter-spacing: .2px;
  transition: all .15s;
}

.btn-danger  { background: var(--mc-rojo);  border-color: var(--mc-rojo); }
.btn-danger:hover  { background: var(--mc-rojo-dark); border-color: var(--mc-rojo-dark); }

.btn-primary { background: var(--mc-azul);  border-color: var(--mc-azul); }
.btn-primary:hover { background: var(--mc-azul-dark); border-color: var(--mc-azul-dark); }

.btn-outline-danger:hover  { background: var(--mc-rojo);  color: #fff; }
.btn-outline-primary:hover { background: var(--mc-azul);  color: #fff; }

/* ── Formularios ─────────────────────────────────────────────── */
.form-control,
.form-select {
  border-radius: 8px;
  border-color: var(--mc-border);
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--mc-azul);
  box-shadow: 0 0 0 .2rem rgba(21,101,192,.18);
}

.form-label {
  font-size: .82rem;
  margin-bottom: .35rem;
  color: var(--mc-text);
}

.input-group-text {
  background: #F8FAFC;
  border-color: var(--mc-border);
  color: var(--mc-muted);
  font-weight: 600;
}

/* ── Tablas ──────────────────────────────────────────────────── */
.table-mcoop {
  font-size: .855rem;
}

.table-mcoop thead th {
  background: #F8FAFC;
  color: var(--mc-muted);
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 2px solid var(--mc-border);
  padding: .65rem .85rem;
  white-space: nowrap;
}

.table-mcoop tbody td {
  vertical-align: middle;
  padding: .6rem .85rem;
  border-bottom: 1px solid #F3F4F6;
}

.table-mcoop tbody tr:last-child td { border-bottom: none; }
.table-mcoop tbody tr:hover { background: #FAFBFC; }

.table-mcoop tfoot td {
  padding: .65rem .85rem;
  font-size: .85rem;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .3px;
  border-radius: 6px;
  padding: .3em .65em;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  font-size: .875rem;
  border-width: 1px;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
  background: var(--mc-sidebar);
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}

#sidebar .nav-link {
  font-size: .84rem;
  border-radius: 8px;
  transition: background .12s, color .12s;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
  background: var(--mc-rojo);
  color: #fff !important;
}

.nav-section-title {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #4B5563;
  padding: 1.1rem 1.25rem .35rem;
}

/* ── Topbar ──────────────────────────────────────────────────── */
#topbar {
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,.96);
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 90px;
}

.stat-card .stat-label {
  font-size: .72rem;
  font-weight: 600;
  opacity: .88;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: .3rem;
}

.stat-card .stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.5px;
}

.stat-card .stat-sub {
  font-size: .7rem;
  opacity: .78;
  margin-top: .2rem;
}

.stat-card .stat-icon {
  font-size: 2.8rem;
  opacity: .15;
  position: absolute;
  right: .85rem;
  bottom: .5rem;
}

.stat-ventas   { background: linear-gradient(135deg, #D32F2F 0%, #B71C1C 100%); }
.stat-caja     { background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%); }
.stat-stock    { background: linear-gradient(135deg, #E65100 0%, #BF360C 100%); }
.stat-liquidac { background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%); }

/* ── Tabla en caja — badge inline ────────────────────────────── */
.topbar-caja {
  font-size: .78rem;
  font-weight: 700;
  padding: .3rem .85rem;
  border-radius: 20px;
}
.caja-abierta { background: #DCFCE7; color: #166534; }
.caja-cerrada { background: #FEE2E2; color: #991B1B; }

/* ── Modales ─────────────────────────────────────────────────── */
.modal-content { border-radius: var(--radius); border: none; box-shadow: var(--shadow-md); }
.modal-header  { border-radius: var(--radius) var(--radius) 0 0; }

/* ── Código inline ───────────────────────────────────────────── */
code {
  background: #F1F5F9;
  color: var(--mc-rojo);
  padding: .15em .4em;
  border-radius: 4px;
  font-size: .82em;
}

/* ── Search autocomplete list ────────────────────────────────── */
#listaProductos {
  border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--mc-border);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
}

#listaProductos .list-group-item {
  border-left: none;
  border-right: none;
  font-size: .855rem;
  padding: .6rem 1rem;
}

#listaProductos .list-group-item:hover {
  background: #FEF2F2;
  border-left: 3px solid var(--mc-rojo);
}

/* ── PEPS badge ──────────────────────────────────────────────── */
.badge-fifo {
  background: linear-gradient(135deg,#2E7D32,#1B5E20);
  color:#fff;
  font-size:.65rem;
  padding:.3em .6em;
  border-radius:4px;
  font-weight:700;
  letter-spacing:.5px;
}

/* ── Print styles ────────────────────────────────────────────── */
@media print {
  #sidebar, #topbar, .btn, .alert-dismissible .btn-close { display: none !important; }
  #main { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body  { background: #fff !important; font-size: 11pt; }
  .stat-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 992px) {
  #main    { margin-left: 0; }
  #topbar  { left: 0; }
  .stat-card .stat-value { font-size: 1.25rem; }
}

@media (max-width: 576px) {
  .table-mcoop thead th,
  .table-mcoop tbody td { padding: .45rem .6rem; font-size: .8rem; }
  .stat-card { padding: .9rem 1rem; min-height: 75px; }
  .stat-card .stat-value { font-size: 1.1rem; }
}

/* ── Animaciones suaves ──────────────────────────────────────── */
.fade-in {
  animation: fadeIn .3s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Aplicar fade-in a las cards del dashboard */
.card { animation: fadeIn .25s ease-out; }
