/* ═══════════════════════════════════════════════
   CalcuPrecios — style.css
   Mobile-first | Bootstrap 5 override
═══════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --cp-primary:      #e63946;
  --cp-primary-dark: #c1121f;
  --cp-secondary:    #f4a261;
  --cp-accent:       #2a9d8f;
  --cp-dark:         #1d3557;
  --cp-dark2:        #2d4a6e;
  --cp-light-bg:     #f0f4ff;
  --cp-card-shadow:  0 2px 18px rgba(0,0,0,0.08);
  --cp-radius:       12px;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: linear-gradient(150deg, #fff9f0 0%, #f4f6fb 100%);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  padding-bottom: 3rem;
  color: #212529;
}

/* ════════════════════════════
   NAVBAR
════════════════════════════ */
.navbar {
  background: linear-gradient(135deg, var(--cp-dark) 0%, var(--cp-dark2) 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.navbar-brand i {
  color: var(--cp-secondary);
}

.fs-badge {
  font-size: 0.72rem !important;
}

/* ════════════════════════════
   CARDS
════════════════════════════ */
.card {
  border: none;
  border-radius: var(--cp-radius);
  box-shadow: var(--cp-card-shadow);
  overflow: hidden;
}

.card-header {
  background: linear-gradient(135deg, var(--cp-dark) 0%, var(--cp-dark2) 100%);
  color: #fff;
  padding: 0.8rem 1.25rem;
  border-bottom: none;
}

.card-header h5 {
  font-size: 0.97rem;
  font-weight: 600;
  margin: 0;
}

.card-body {
  padding: 1.25rem;
}

/* ════════════════════════════
   STEP BADGE
════════════════════════════ */
.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cp-secondary);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(244,162,97,0.45);
}

/* ════════════════════════════
   FORM CONTROLS
════════════════════════════ */
.form-control:focus,
.form-select:focus {
  border-color: var(--cp-primary);
  box-shadow: 0 0 0 0.2rem rgba(230,57,70,0.18);
}

.form-label {
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
}

/* Switch personalizado */
.form-check-input:checked {
  background-color: var(--cp-accent);
  border-color: var(--cp-accent);
}

/* ════════════════════════════
   INGREDIENT FORM
════════════════════════════ */
.ingredient-form {
  background: var(--cp-light-bg) !important;
  border: 1.5px dashed #b0bedc !important;
}

/* ════════════════════════════
   BOTONES
════════════════════════════ */
.btn-primary {
  background-color: var(--cp-primary);
  border-color: var(--cp-primary);
  font-weight: 600;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--cp-primary-dark);
  border-color: var(--cp-primary-dark);
}

.btn-danger {
  background-color: var(--cp-primary);
  border-color: var(--cp-primary);
  font-weight: 600;
}
.btn-danger:hover {
  background-color: var(--cp-primary-dark);
  border-color: var(--cp-primary-dark);
}

/* Botón eliminar fila */
.btn-remove-ing {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.78rem;
}

/* ════════════════════════════
   TABLA DE INGREDIENTES
════════════════════════════ */
.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.table td {
  font-size: 0.88rem;
}

.table tfoot td {
  border-top: 2px solid #dee2e6;
  font-size: 0.9rem;
}

/* Fila de ingrediente con animación */
.ing-row {
  animation: fadeSlideIn 0.25s ease;
}

.ing-row td:first-child {
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ════════════════════════════
   SUMMARY BOX
════════════════════════════ */
.summary-box {
  background: #fff;
  border-radius: 10px;
  padding: 1rem 1.15rem;
  border: 1px solid #e3e8f0;
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
}

.summary-title {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--cp-dark);
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--cp-light-bg);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.42rem 0;
  border-bottom: 1px dashed #f0f0f0;
  font-size: 0.88rem;
  gap: 0.5rem;
}

.summary-row:last-child { border-bottom: none; }

.summary-row span { color: #555; }

.summary-row.profit-row strong { color: var(--cp-accent); }

.summary-row.total-row {
  padding-top: 0.65rem;
  margin-top: 0.3rem;
  border-top: 2px solid #dee2e6;
  border-bottom: none;
}

.summary-row.total-row span {
  font-weight: 700;
  color: var(--cp-dark);
}

/* ════════════════════════════
   COSTOS INDIRECTOS PANEL
════════════════════════════ */
.extra-cost-row {
  animation: fadeSlideIn 0.2s ease;
}

.extra-cost-row .form-control {
  font-size: 0.85rem;
}

/* ════════════════════════════
   CATÁLOGO — MODAL
════════════════════════════ */
.catalog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 0.4rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  animation: fadeSlideIn 0.2s ease;
  gap: 0.5rem;
}

.catalog-item:hover {
  border-color: var(--cp-primary);
  box-shadow: 0 2px 10px rgba(230,57,70,0.1);
}

.catalog-item-info { flex: 1; min-width: 0; }

.catalog-item-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-item-detail {
  font-size: 0.76rem;
  color: #6c757d;
}

.catalog-category-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: #fff;
  background: var(--cp-dark);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
  margin-top: 0.5rem;
  display: inline-block;
}

/* ════════════════════════════
   TOAST
════════════════════════════ */
.toast-container {
  z-index: 9999;
}

.cp-toast {
  border-radius: 10px !important;
  font-size: 0.88rem;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18) !important;
  min-width: 240px;
  max-width: 90vw;
}

/* ════════════════════════════
   ANIMACIONES
════════════════════════════ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

@keyframes pulse {
  0%   { transform: scale(1);    }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1);    }
}

#finalPrice {
  transition: all 0.3s ease;
}

#finalPrice.updated {
  animation: pulse 0.4s ease;
  color: var(--cp-accent) !important;
}

/* ════════════════════════════
   EMPTY STATE
════════════════════════════ */
#emptyIngredients {
  padding: 2.5rem 1rem;
}

#emptyIngredients i {
  color: #ccc;
}

/* ════════════════════════════
   SCROLLBAR PERSONALIZADO
════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb  { background: #ccc;    border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ════════════════════════════
   RESPONSIVE — SM (≥576px)
════════════════════════════ */
@media (min-width: 576px) {
  .card-body { padding: 1.5rem; }
  .card-header h5 { font-size: 1rem; }
  .ing-row td:first-child { max-width: 220px; }
}

/* ════════════════════════════
   RESPONSIVE — MD (≥768px)
════════════════════════════ */
@media (min-width: 768px) {
  .summary-box { padding: 1.2rem 1.4rem; }
  .summary-row { font-size: 0.92rem; }
  #finalPrice  { font-size: 1.25rem !important; }
  .ing-row td:first-child { max-width: 100%; white-space: normal; }
}

/* ════════════════════════════
   RESPONSIVE — LG (≥992px)
════════════════════════════ */
@media (min-width: 992px) {
  .container-lg { max-width: 860px; }
}

/* ════════════════════════════
   PRINT (por si imprimen)
════════════════════════════ */
@media print {
  .navbar, .btn, #card-actions { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
