/* ============================================
   ALMACÉN - Corteza Sistema Integral
   Colores: café oscuro #2b2118, dorado #d6a85f, crema #f7f1e8
============================================ */

/* LAYOUT */
.alm-layout {
  display: flex;
  min-height: calc(100vh - 70px);
}

/* SIDEBAR */
.alm-sidebar {
  width: 220px;
  background-color: #1b1510;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
  flex-shrink: 0;
}

.alm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  color: #c9c9c9;
  text-decoration: none;
  font-size: 14px;
  transition: 0.2s;
  border-left: 4px solid transparent;
}

.alm-nav-item:hover {
  background-color: #2b2118;
  color: white;
}

.alm-nav-item.activo {
  background-color: #2b2118;
  color: #d6a85f;
  border-left-color: #d6a85f;
  font-weight: bold;
}

.alm-nav-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

/* CONTENIDO MAIN */
.alm-main {
  flex: 1;
  padding: 30px;
  background-color: #f7f1e8;
  overflow-y: auto;
  min-width: 0;
}

/* VISTAS */
.alm-vista {
  display: none;
}
.alm-vista.activo {
  display: block;
}

/* PAGE HEADER */
.alm-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 25px;
}

.alm-page-header h2 {
  font-size: 28px;
  color: #2b2118;
  margin: 0;
}

.alm-page-header > div > p {
  color: #666;
  margin: 4px 0 0;
  font-size: 14px;
}

.alm-acciones-rapidas {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* BOTONES */
.btn-alm {
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-alm-primary {
  background-color: #d6a85f;
  color: #2b2118;
}
.btn-alm-primary:hover {
  background-color: #c49345;
}

.btn-alm-secondary {
  background-color: #2b2118;
  color: white;
}
.btn-alm-secondary:hover {
  background-color: #3d2f22;
}

.btn-alm-outline {
  background-color: transparent;
  border: 2px solid #2b2118;
  color: #2b2118;
}
.btn-alm-outline:hover {
  background-color: #2b2118;
  color: white;
}

.btn-alm-danger {
  background-color: #e74c3c;
  color: white;
}
.btn-alm-danger:hover {
  background-color: #c0392b;
}

.btn-alm-success {
  background-color: #27ae60;
  color: white;
}
.btn-alm-success:hover {
  background-color: #1e8449;
}

.btn-alm-sm {
  padding: 6px 12px;
  font-size: 12px;
  background-color: rgba(214,168,95,0.15);
  color: #7a4d25;
  border: 1px solid rgba(214,168,95,0.4);
}
.btn-alm-sm:hover {
  background-color: rgba(214,168,95,0.3);
}

/* TARJETAS RESUMEN */
.alm-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 25px;
}

.alm-card {
  background-color: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  border-left: 5px solid #d6a85f;
}

.alm-card-dorado  { border-left-color: #d6a85f; }
.alm-card-alerta  { border-left-color: #f39c12; }
.alm-card-rojo    { border-left-color: #e74c3c; }
.alm-card-naranja { border-left-color: #e67e22; }

.alm-card-icon {
  font-size: 32px;
  opacity: 0.85;
}

.alm-card-label {
  font-size: 12px;
  color: #888;
  margin: 0 0 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.alm-card-valor {
  font-size: 32px;
  font-weight: bold;
  color: #2b2118;
  margin: 0;
  line-height: 1;
}

/* BUSCADOR */
.alm-buscador-wrap {
  margin-bottom: 22px;
}

.alm-buscador {
  position: relative;
  max-width: 600px;
}

.alm-buscar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
}

.alm-buscador input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  background-color: white;
  transition: 0.2s;
}

.alm-buscador input:focus {
  outline: none;
  border-color: #d6a85f;
  box-shadow: 0 0 0 3px rgba(214,168,95,0.2);
}

/* PANELES */
.alm-panel {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  overflow: hidden;
  margin-bottom: 22px;
}

.alm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.alm-panel-header h3 {
  font-size: 16px;
  color: #2b2118;
  margin: 0;
}

.alm-dos-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

/* TABLAS */
.alm-tabla-wrap {
  overflow-x: auto;
}

.alm-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.alm-tabla thead {
  background-color: #2b2118;
  color: white;
}

.alm-tabla th {
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.alm-tabla td {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.alm-tabla tbody tr:hover {
  background-color: #fdf9f2;
}

.alm-tabla-empty {
  text-align: center;
  padding: 30px;
  color: #888;
  font-size: 14px;
}

/* BADGES / ESTADOS */
.alm-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: bold;
  display: inline-block;
  white-space: nowrap;
}

.alm-badge-verde     { background-color: #d5f5e3; color: #1e8449; }
.alm-badge-rojo      { background-color: #fce4e4; color: #c0392b; }
.alm-badge-amarillo  { background-color: #fef9e7; color: #9a7d0a; }
.alm-badge-naranja   { background-color: #fdebd0; color: #a04000; }
.alm-badge-gris      { background-color: #f0f0f0; color: #555; }
.alm-badge-cafe      { background-color: #2b2118; color: #d6a85f; }
.alm-badge-dorado    { background-color: #d6a85f; color: #2b2118; }
.alm-badge-azul      { background-color: #d6eaf8; color: #1a5276; }

/* FILTROS */
.alm-filtros {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* INPUTS / SELECTS GENERALES */
.alm-input {
  padding: 10px 13px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background-color: white;
  width: 100%;
  box-sizing: border-box;
  transition: 0.2s;
  font-family: inherit;
  color: #2b2118;
}

.alm-input:focus {
  outline: none;
  border-color: #d6a85f;
  box-shadow: 0 0 0 3px rgba(214,168,95,0.2);
}

.alm-select {
  padding: 10px 13px;
  border: 2px solid #ddd;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  background-color: white;
  transition: 0.2s;
  font-family: inherit;
  color: #2b2118;
  cursor: pointer;
}

.alm-select:focus {
  outline: none;
  border-color: #d6a85f;
}

.alm-textarea {
  resize: vertical;
  min-height: 70px;
}

/* MODALES */
.alm-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.alm-modal-backdrop.activo {
  display: flex;
}

.alm-modal {
  background-color: white;
  border-radius: 14px;
  width: 95%;
  max-width: 700px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.25s ease;
}

.alm-modal-lg {
  max-width: 900px;
}

@keyframes modalIn {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.alm-modal-header {
  background-color: #2b2118;
  color: white;
  padding: 18px 22px;
  border-radius: 14px 14px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.alm-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #d6a85f;
}

.alm-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: 0.2s;
}

.alm-modal-close:hover { color: #d6a85f; }

.alm-modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.alm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
  background: white;
  border-radius: 0 0 14px 14px;
}

/* FORM GRID */
.alm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.alm-form-grupo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.alm-form-grupo label {
  font-size: 13px;
  font-weight: 600;
  color: #2b2118;
}

.alm-span-2 {
  grid-column: span 2;
}

/* TABS */
.alm-detalle-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0d4c4;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.alm-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: 0.2s;
}

.alm-tab:hover { color: #2b2118; }

.alm-tab.activo {
  color: #d6a85f;
  border-bottom-color: #d6a85f;
}

.alm-tab-content {
  display: none;
}
.alm-tab-content.activo {
  display: block;
}

/* INFO GRID DEL DETALLE */
.alm-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.alm-info-item {
  background-color: #fdf9f2;
  border: 1px solid #e8d9c4;
  border-radius: 8px;
  padding: 14px;
}

.alm-info-item .label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: #888;
  margin-bottom: 5px;
}

.alm-info-item .valor {
  font-size: 14px;
  color: #2b2118;
  font-weight: 600;
}

/* DRIVE PANEL */
.alm-drive-panel {
  background-color: #fdf9f2;
  border: 2px dashed #d6a85f;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
}

.alm-drive-panel h4 {
  color: #2b2118;
  margin: 0 0 12px;
  font-size: 15px;
}

.alm-drive-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* RESUMEN EN MODAL DE DEVOLUCIÓN */
.alm-resumen-devolucion {
  background-color: #fdf9f2;
  border: 1px solid #e8d9c4;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: #2b2118;
  line-height: 1.8;
}

/* AVISO STOCK */
.alm-aviso {
  background-color: #fdebd0;
  border: 1px solid #e67e22;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #a04000;
  margin-top: 10px;
}

.alm-aviso-rojo {
  background-color: #fce4e4;
  border-color: #e74c3c;
  color: #a93226;
}

/* TOAST */
.alm-toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  padding: 13px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: 350px;
}

.alm-toast.mostrar {
  opacity: 1;
  transform: translateY(0);
}

.alm-toast.exito { background-color: #27ae60; color: white; }
.alm-toast.error { background-color: #e74c3c; color: white; }
.alm-toast.info  { background-color: #2b2118; color: #d6a85f; }

/* VENCIDO */
.alm-vencido {
  background-color: #fff5f5 !important;
}
.alm-vencido td {
  color: #c0392b;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .alm-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .alm-dos-cols {
    grid-template-columns: 1fr;
  }
  .alm-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .alm-layout {
    flex-direction: column;
  }
  .alm-sidebar {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
  }
  .alm-nav-item {
    padding: 10px 14px;
    border-left: none;
    border-bottom: 3px solid transparent;
    font-size: 12px;
  }
  .alm-nav-item.activo {
    border-left: none;
    border-bottom-color: #d6a85f;
  }
  .alm-main {
    padding: 18px;
  }
  .alm-form-grid {
    grid-template-columns: 1fr;
  }
  .alm-span-2 {
    grid-column: span 1;
  }
  .alm-modal-lg {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .alm-cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .alm-page-header {
    flex-direction: column;
  }
  .alm-acciones-rapidas {
    width: 100%;
  }
  .alm-btn {
    flex: 1;
    justify-content: center;
  }
}

/* MODAL CATÁLOGO - DISEÑO MEJORADO */
.modal-catalogo .alm-modal {
  max-width: 600px;
  border-radius: 20px;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(43, 33, 24, 0.35);
  background: linear-gradient(180deg, #ffffff 0%, #faf8f5 100%);
  border: 1px solid #e8dcc8;
}

.modal-catalogo .alm-modal-header {
  background: linear-gradient(135deg, #2b2118 0%, #4a3b2e 100%);
  padding: 20px 26px;
  border-radius: 20px 20px 0 0;
}

.modal-catalogo .alm-modal-header h3 {
  font-size: 20px;
  color: #d6a85f;
  letter-spacing: 0.5px;
}

.modal-catalogo form {
  padding: 26px;
}

.modal-catalogo .alm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.modal-catalogo .alm-form-grupo {
  gap: 8px;
}

.modal-catalogo .alm-form-grupo label {
  font-size: 13px;
  font-weight: 700;
  color: #2b2118;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-catalogo .alm-input {
  background: #ffffff;
  border: 2px solid #e8dcc8;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  transition: all 0.2s;
}

.modal-catalogo .alm-input:focus {
  border-color: #d6a85f;
  box-shadow: 0 0 0 4px rgba(214, 168, 95, 0.15);
}

.modal-catalogo .alm-textarea {
  min-height: 90px;
  resize: vertical;
}

.modal-catalogo .alm-modal-footer {
  border-top: 1px solid #e8dcc8;
  padding-top: 22px;
  margin-top: 24px;
  justify-content: center;
  gap: 16px;
}

.modal-catalogo .alm-modal-footer .btn-alm {
  padding: 12px 28px;
  font-weight: 600;
  border-radius: 10px;
  min-width: 130px;
}

.modal-catalogo .alm-modal-footer .btn-alm-primary {
  background: linear-gradient(135deg, #d6a85f 0%, #c49a55 100%);
  box-shadow: 0 4px 12px rgba(214, 168, 95, 0.3);
}

.modal-catalogo .alm-modal-footer .btn-alm-outline {
  border: 2px solid #d6a85f;
  color: #2b2118;
}

.modal-catalogo .alm-modal-footer .btn-alm-outline:hover {
  background: #d6a85f;
  color: white;
}

@media (max-width: 600px) {
  .modal-catalogo .alm-form-grid {
    grid-template-columns: 1fr;
  }
  .modal-catalogo form {
    padding: 18px;
  }
  .modal-catalogo .alm-modal-footer {
    flex-direction: column;
  }
  .modal-catalogo .alm-modal-footer .btn-alm {
    width: 100%;
  }
}
