/* ============================================================
   CENTRALMOTO — inventario.css
   Página de control interno. Sin decoración, máxima densidad
   de información, optimizada para uso diario del equipo.
   ============================================================ */

.inv2-body {
    margin: 0;
}

/* ══ TOPBAR MÍNIMA ══ */
.inv2-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--negro-card);
    border-bottom: 2px solid var(--rojo);
    position: sticky; top: 0; z-index: 50;
}
.inv2-topbar-left {
    display: flex; align-items: center; gap: 1rem;
}
.inv2-logo-link { display: flex; align-items: center; }
.inv2-logo { height: 28px; width: auto; }
.inv2-titulo {
    font-family: var(--font-display);
    font-size: 1.1rem; letter-spacing: 0.04em;
    color: var(--hueso);
}
.inv2-volver {
    font-size: 0.78rem; font-weight: 600;
    color: var(--gris-muted); text-decoration: none;
    transition: color var(--t-fast);
}
.inv2-volver:hover { color: var(--rojo); }

/* ══ MAIN — ocupa todo el ancho, sin márgenes decorativos ══ */
.inv2-main {
    padding: 1.25rem 1.5rem 3rem;
    max-width: 100%;
}

/* ══ RESUMEN ══ */
.inv2-resumen {
    display: grid;
    grid-template-columns: repeat(4, 1fr) 1.6fr;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.inv2-resumen-card {
    background: var(--negro-card);
    border: 1px solid var(--gris-borde);
    border-radius: var(--r-md);
    padding: 0.9rem 1.1rem;
    display: flex; flex-direction: column; gap: 0.2rem;
}
.inv2-resumen-label {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--gris-muted);
}
.inv2-resumen-valor {
    font-family: var(--font-display);
    font-size: 1.7rem; color: var(--blanco); letter-spacing: 0.02em;
}
.inv2-resumen-fotos { gap: 0.4rem; }
.inv2-barra-progreso {
    height: 6px; background: rgba(255,255,255,0.08);
    border-radius: 3px; overflow: hidden; margin-top: 0.2rem;
}
.inv2-barra-fill {
    height: 100%; background: var(--rojo);
    border-radius: 3px; transition: width 0.4s ease;
}
.inv2-resumen-detalle {
    font-size: 0.68rem; color: var(--gris-sub);
}

/* ══ FILTROS ══ */
.inv2-filtros {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.75rem; margin-bottom: 1rem;
    position: sticky; top: 57px; z-index: 40;
    background: var(--negro);
    padding: 0.75rem 0;
}
.inv2-filtros input[type="text"] {
    flex: 1 1 280px;
    padding: 0.55rem 0.9rem;
    background: var(--negro-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--r-sm); color: var(--hueso);
    font-family: var(--font-body); font-size: 0.85rem;
    outline: none; transition: border-color var(--t-fast);
}
.inv2-filtros input[type="text"]:focus { border-color: var(--rojo); }
.inv2-filtros select {
    padding: 0.55rem 0.9rem;
    background: var(--negro-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--r-sm); color: var(--hueso);
    font-size: 0.85rem; cursor: pointer; outline: none;
}
.inv2-filtros select option { background: var(--negro-card); }
.inv2-check {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; color: var(--gris-muted); cursor: pointer;
    white-space: nowrap;
}
.inv2-check input { accent-color: var(--rojo); cursor: pointer; }
.inv2-contador {
    font-size: 0.78rem; color: var(--gris-muted);
    margin-left: auto; white-space: nowrap;
}

/* ══ TABLA — denso, full width ══ */
.inv2-tabla-section { width: 100%; }
.inv2-tabla-wrap {
    overflow-x: auto;
    border: 1px solid var(--gris-borde);
    border-radius: var(--r-md);
}
.inv2-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 1100px;
}
.inv2-tabla thead {
    background: var(--negro-card);
    position: sticky; top: 0; z-index: 10;
}
.inv2-tabla th {
    text-align: left; padding: 0.65rem 0.85rem;
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--gris-muted);
    border-bottom: 2px solid var(--rojo);
    white-space: nowrap;
}
.inv2-th-ordenable {
    cursor: pointer; user-select: none;
    transition: color var(--t-fast);
}
.inv2-th-ordenable:hover { color: var(--blanco); }
.inv2-tabla td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--gris-borde);
    color: var(--hueso);
    vertical-align: middle;
}
.inv2-tabla tbody tr:hover { background: rgba(237,28,36,0.05); }

/* Columna de acción (compartir) fija a la derecha — siempre visible
   sin necesidad de hacer scroll horizontal hasta el final. */
.inv2-tabla th:last-child,
.inv2-tabla td:last-child {
    position: sticky; right: 0;
    background: var(--negro-card);
    box-shadow: -4px 0 8px rgba(0,0,0,0.3);
    text-align: center;
    width: 48px;
}
.inv2-tabla thead th:last-child {
    z-index: 11; /* por encima del thead sticky normal */
}
.inv2-tabla tbody td:last-child {
    background: var(--negro);
}
.inv2-tabla tbody tr:hover td:last-child {
    background: #1a1414; /* mismo tono que el hover de la fila */
}

/* Foto miniatura */
.inv2-col-foto { width: 56px; }
.inv2-foto-wrap {
    width: 44px; height: 44px;
    background: var(--negro-deep);
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.inv2-foto-wrap img {
    width: 100%; height: 100%; object-fit: contain;
}
.inv2-no-foto {
    font-size: 0.6rem; color: var(--gris-sub);
    text-align: center; line-height: 1.2;
}

.inv2-mono { font-family: monospace; font-size: 0.78rem; color: var(--gris-muted); }
.inv2-desc { min-width: 220px; font-weight: 500; }
.inv2-tag {
    font-size: 0.66rem; padding: 0.15rem 0.5rem;
    background: rgba(255,255,255,0.06);
    border-radius: 3px; color: var(--gris-muted);
    white-space: nowrap;
}
.inv2-num { text-align: center; font-weight: 600; }
.inv2-total { color: var(--rojo); font-weight: 700; }
.inv2-precio { white-space: nowrap; font-weight: 600; }
.inv2-proveedor { font-size: 0.76rem; color: var(--gris-muted); white-space: nowrap; }
.inv2-comentarios {
    font-size: 0.76rem; color: var(--gris-sub);
    max-width: 220px; font-style: italic;
}

/* Filas con stock bajo o cero — resaltado visual */
.inv2-stock-bajo { background: rgba(255,180,0,0.04); }
.inv2-stock-bajo .inv2-total { color: #FFB800; }
.inv2-stock-cero { background: rgba(237,28,36,0.06); }
.inv2-stock-cero .inv2-total { color: var(--rojo); }

.inv2-empty {
    text-align: center; padding: 3rem !important;
    color: var(--gris-muted); font-style: italic;
}

/* ══ RESPONSIVE ══ */
@media (max-width: 1100px) {
    .inv2-resumen { grid-template-columns: repeat(2, 1fr); }
    .inv2-resumen-fotos { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .inv2-main { padding: 1rem 0.75rem 2rem; }
    .inv2-titulo { display: none; }
    .inv2-filtros { top: 49px; }
    .inv2-filtros input[type="text"] { flex: 1 1 100%; }
    .inv2-contador { margin-left: 0; }
}

/* ══════════════════════════════════════════════════════════
   VISTA MÓVIL TIPO APP — tarjetas apiladas
   En desktop se oculta (se ve la tabla), en móvil se muestra
   y la tabla se oculta. Mismo dato, distinta presentación.
══════════════════════════════════════════════════════════ */
.inv2-cards-section { display: none; }
.inv2-cards {
    display: flex; flex-direction: column; gap: 0.85rem;
}

.inv2-card {
    display: flex; gap: 0.85rem;
    background: var(--negro-card);
    border: 1px solid var(--gris-borde);
    border-radius: var(--r-lg);
    padding: 0.85rem;
    transition: border-color var(--t-fast);
}
.inv2-card.inv2c-stock-bajo { border-color: rgba(255,180,0,0.3); }
.inv2-card.inv2c-stock-cero { border-color: rgba(237,28,36,0.35); }

.inv2-card-foto {
    width: 76px; height: 76px; flex-shrink: 0;
    background: var(--negro-deep);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.inv2-card-foto img { width: 100%; height: 100%; object-fit: contain; }
.inv2c-no-foto { font-size: 1.8rem; opacity: 0.3; }

.inv2-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.inv2-card-desc {
    font-family: var(--font-body); font-weight: 600;
    font-size: 0.88rem; color: var(--hueso);
    line-height: 1.35;
}
.inv2-card-meta {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.inv2-card-sku {
    font-size: 0.66rem; color: var(--gris-sub); font-family: monospace;
}

.inv2-card-stock-row {
    display: flex; gap: 0.5rem;
}
.inv2-card-stock-item {
    flex: 1; text-align: center;
    background: rgba(255,255,255,0.03);
    border-radius: var(--r-sm);
    padding: 0.35rem 0.2rem;
}
.inv2-card-stock-label {
    display: block; font-size: 0.6rem; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--gris-sub); margin-bottom: 0.1rem;
}
.inv2-card-stock-val {
    display: block; font-size: 0.92rem; font-weight: 700; color: var(--hueso);
}
.inv2-card-stock-total .inv2-card-stock-val { color: var(--rojo); }

.inv2-card-comentarios {
    font-size: 0.72rem; color: var(--gris-sub); font-style: italic;
    line-height: 1.4;
}

.inv2-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 0.2rem; padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.inv2-card-precio {
    font-family: var(--font-display); font-size: 1.05rem;
    color: var(--hueso); letter-spacing: 0.02em;
}

/* ══ BOTÓN COMPARTIR ══ */
.inv2-btn-compartir {
    background: rgba(237,28,36,0.15);
    border: 1px solid rgba(237,28,36,0.4);
    border-radius: var(--r-sm);
    color: var(--rojo);
    font-size: 1.05rem;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast);
}
.inv2-btn-compartir:hover { background: rgba(237,28,36,0.28); transform: scale(1.08); }
.inv2-btn-compartir-card {
    font-size: 0.74rem; font-weight: 700;
    padding: 0.4rem 0.85rem;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   MODAL DE TARJETA PARA COMPARTIR
══════════════════════════════════════════════════════════ */
.tc-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    padding: 1.25rem;
    backdrop-filter: blur(4px);
}
.tc-modal {
    position: relative;
    max-width: 420px; width: 100%;
}
.tc-cerrar {
    position: absolute; top: -2.75rem; right: 0;
    background: rgba(255,255,255,0.1); border: none;
    color: var(--hueso); font-size: 1.2rem;
    width: 38px; height: 38px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* La tarjeta visual — grande y nítida para que la captura de
   pantalla se vea profesional cuando se comparte. */
.tc-card {
    background: var(--negro);
    border: 2px solid var(--rojo);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.tc-card-img {
    height: 280px;
    background: linear-gradient(160deg, #1c1c1c, #222);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.tc-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 1rem; }
.tc-no-foto { font-size: 4rem; opacity: 0.25; }

.tc-card-body { padding: 1.4rem 1.5rem; }
.tc-marca {
    font-family: var(--font-display); font-size: 0.9rem;
    letter-spacing: 0.18em; color: var(--rojo);
}
.tc-card-body h3 {
    font-family: var(--font-display); font-size: 1.7rem;
    color: var(--blanco); letter-spacing: 0.02em;
    margin: 0.4rem 0 0.2rem; line-height: 1.2;
}
.tc-categoria {
    font-size: 0.85rem; color: var(--gris-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 1rem;
}
.tc-precio-row {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 0.85rem; border-top: 1px solid rgba(255,255,255,0.08);
}
.tc-precio {
    font-family: var(--font-display); font-size: 1.9rem;
    color: var(--rojo); letter-spacing: 0.02em;
}
.tc-disponible {
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: #1D9E75;
    background: rgba(29,158,117,0.15);
    padding: 0.3rem 0.7rem; border-radius: 4px;
}
.tc-footer {
    display: flex; justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: var(--rojo);
    font-size: 0.82rem; font-weight: 600; color: var(--blanco);
}

.tc-instruccion {
    text-align: center; margin-top: 1.1rem;
    font-size: 0.82rem; color: var(--gris-muted);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — el cambio clave: tabla → tarjetas en móvil
══════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
    .inv2-tabla-section { display: none; }
    .inv2-cards-section { display: block; }

    /* Topbar más compacta, estilo app */
    .inv2-topbar { padding: 0.65rem 1rem; }
    .inv2-logo { height: 24px; }

    /* Filtros apilados, como una barra de búsqueda de app */
    .inv2-filtros {
        flex-direction: column; align-items: stretch;
        gap: 0.6rem; top: 49px;
    }
    .inv2-filtros input[type="text"] { font-size: 0.9rem; padding: 0.7rem 1rem; }
    .inv2-filtros select { width: 100%; }
    .inv2-check { justify-content: space-between; width: 100%; }
    .inv2-contador { margin-left: 0; text-align: center; padding-top: 0.2rem; }

    /* Resumen en 2 columnas, más compacto */
    .inv2-resumen { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .inv2-resumen-fotos { grid-column: 1 / -1; }
    .inv2-resumen-card { padding: 0.7rem 0.85rem; }
    .inv2-resumen-valor { font-size: 1.4rem; }
}
