/* ═══════════════════════════════════════════════════════════════════════
   Productos.css  –  Rediseño premium de tarjetas de productos
   NegocioRodar Design System – Optimizado para 1366×768 y 1920×1080
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Container ───────────────────────────────────────────────────────── */
.container {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

h1 {
    margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════
   CARD DE FILTROS
   ═══════════════════════════════════════════════════════════════════════ */
.card {
    background-color: #282b2d6d;
    border: none;
    text-align: center;
    border-radius: 18px;
    box-shadow: none;
    margin-bottom: 14px;
}

.card-header {
    background-color: transparent;
    border-bottom: none;
}

.card-body {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 18px;
    color: #F7F0E2;
    padding-top: 0;
}

.card-body .row {
    background-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════
   GRID DE PRODUCTOS (tarjetas)
   ═══════════════════════════════════════════════════════════════════════ */
.row {
    background-color: #282b2d6d;
    border-radius: 14px;
    padding: 10px 6px;
}

/* ── Tarjeta individual ──────────────────────────────────────────────── */
.product-item {
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    animation: fadeIn 0.3s ease-out;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

/* ── Imagen del producto ─────────────────────────────────────────────── */
.product-img {
    position: relative;
    overflow: hidden;
    background-color: #fafafa;
    height: clamp(130px, 13vw, 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.imga {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    padding: 8px;
}

.product-img:hover .imga {
    transform: scale(1.06);
}

/* ── Botones de acción sobre la imagen ───────────────────────────────── */
.product-action {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(40, 43, 45, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 8px;
    display: flex;
    justify-content: center;
    gap: 8px;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.product-img:hover .product-action {
    transform: translateY(0);
}

/* Botones dentro de la acción del producto */
.btn-outline-dark {
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #F2E6D8;
    padding: 0;
}

.btn-outline-dark:hover {
    background-color: var(--nr-primary, #A60825);
    border-color: var(--nr-primary, #A60825);
    color: #fff;
    transform: scale(1.1);
}

.btn-outline-dark i {
    font-size: 0.9rem;
    color: inherit;
}

.btn-outline-dark .icon {
    color: #ff4444;
    width: 18px;
    height: 18px;
    display: block;
}

.btn-outline-dark:hover .icon {
    color: #fff;
}

/* ── Información del producto ────────────────────────────────────────── */
.product-item .text-center {
    padding: 10px 12px 8px;
    border: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Nombre / Marca / Medidas */
.product-item .text-center > div:first-child {
    font-weight: 600;
    font-size: 0.82rem;
    color: #282B2D;
    line-height: 1.3;
    margin-bottom: 4px;
}

.product-item .text-center .col {
    padding: 0;
}

/* Precio venta */
.precioVenta {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--nr-primary, #A60825);
    margin: 0;
}

/* Precio costo */
.product-item h6 {
    font-size: 0.75rem;
    color: #888;
    text-decoration: line-through;
    margin: 0;
    font-weight: 400;
}

/* Proveedor */
.product-item .text-primary {
    font-size: 0.72rem;
    color: var(--nr-info, #0052A3) !important;
    font-weight: 500;
}

/* Descripción */
.product-item .text-center span:last-child {
    font-size: 0.75rem;
    color: #666;
}

/* ═══════════════════════════════════════════════════════════════════════
   ALERTAS
   ═══════════════════════════════════════════════════════════════════════ */
.alert {
    border-radius: 12px;
    padding: 1.2rem;
    margin: 1.5rem 0;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

/* ═══════════════════════════════════════════════════════════════════════
   ANIMACIONES
   ═══════════════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════
   FORMULARIOS MODALES DE PRODUCTO (Crear / Editar)
   ═══════════════════════════════════════════════════════════════════════ */

/* Form layout flexbox */
.modal-body form {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.form__group {
    position: relative;
    margin-bottom: 0.3rem;
    width: 100%;
    flex: 0 0 calc(50% - 7px);
    text-align: center;
}

.descipcion {
    width: 100%;
    flex: 0 0 100%;
    display: flex;
    align-content: space-between;
    align-items: center;
    justify-content: space-evenly;
    flex-wrap: nowrap;
    flex-direction: column-reverse;
}

#Descripcion, #DescripcionUpdate {
    resize: none;
    max-height: 40px;
    border-radius: 8px;
    width: 100%;
    border: 2px solid #e9ecef;
}

.form__group--full {
    width: 100%;
    flex: 0 0 100%;
}

.form__group:nth-child(odd) {
    margin-right: 0;
}

.descripcionUdpateLabel {
    transform: translateY(20px);
}

/* Botones del form */
.form-buttons {
    width: 100%;
    gap: 10px;
    text-align: center;
}

/* ── Upload de imagen ────────────────────────────────────────────────── */
.imagen-field {
    display: flex;
    width: 100%;
    gap: 12px;
    height: clamp(160px, 20vw, 260px);
    align-items: stretch;
}

.imagen-preview-container {
    display: flex;
    justify-content: center;
    width: 55%;
    min-width: 0;
}

#imagen-preview, #imagen-preview-update {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    max-width: 100%;
    width: 100%;
    max-height: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 2px dashed #282b2d40;
    background: #fafafa;
}

#imagen-preview img, #imagen-preview-update img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.custum-file-upload {
    border: 2px dashed #282b2d40;
    background-color: #f8f9fa;
    border-radius: 12px;
    margin: 0;
    padding: 1.5rem 1rem;
    transition: all 0.3s ease;
    text-align: center;
    width: 45%;
    min-width: 0;
    display: flex;
    align-content: center;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.custum-file-upload i {
    font-size: 1.5rem;
    color: #888;
    transition: color 0.2s;
}

.custum-file-upload:hover {
    border-color: var(--nr-primary, #A60825);
    background-color: rgba(166, 8, 37, 0.04);
}

.custum-file-upload:hover i {
    color: var(--nr-primary, #A60825);
}

#file, #fileUpdate {
    display: none;
}

/* ── Modal de imagen ampliada ────────────────────────────────────────── */
#imagen-modal .modal-dialog {
    max-width: clamp(40vw, 700px, 70vw);
    width: auto;
    margin: 2vh auto;
    text-align: center;
}

#imagen-modal .modal-content {
    background-color: transparent;
    border: none;
    box-shadow: none;
}

/* ── Dialog de crear/editar producto ─────────────────────────────────── */
#modalCrearProducto .modal-dialog {
    max-width: min(92vw, 800px);
}

#modalEditarProducto .modal-dialog {
    max-width: min(92vw, 800px);
}

/* ── Validaciones ────────────────────────────────────────────────────── */
.text-danger {
    font-size: 0.80rem;
    margin-top: 0.3rem;
    color: #dc3545;
    display: block;
}

/* ── Checkbox de ganancia ────────────────────────────────────────────── */
.form-check {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.65);
    margin-top: 4px;
    gap: 6px;
    border-radius: 20px;
    color: #000;
    flex-wrap: wrap;
    padding: 6px 10px;
}

.ganancia-options {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.percent {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.percent:hover {
    cursor: pointer;
}

.form-check-label {
    font-size: 0.82rem;
    cursor: pointer;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1366×768 laptop ─────────────────────────────────────────────────── */
@media (max-width: 1400px) {
    .product-img {
        height: clamp(110px, 11vw, 160px);
    }
    .product-item .text-center {
        padding: 8px 10px 6px;
    }
    .product-item .text-center > div:first-child {
        font-size: 0.78rem;
    }
    .precioVenta {
        font-size: 0.92rem;
    }
    .imagen-field {
        height: clamp(140px, 16vw, 200px);
    }
    #modalCrearProducto .modal-dialog,
    #modalEditarProducto .modal-dialog {
        max-width: min(95vw, 720px);
    }
    .form__group {
        width: calc(50% - 7px);
        flex: 0 0 calc(50% - 7px);
    }
    .modal-body form {
        gap: 10px;
    }
}

/* ── Tablets / pantallas medianas ─────────────────────────────────────── */
@media (max-width: 968px) {
    .product-img {
        height: 140px;
    }
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 568px) {
    .form__group {
        width: 100%;
        flex: 0 0 100%;
        margin-right: 0;
    }
    .imagen-field {
        flex-direction: column;
        height: auto;
    }
    .imagen-preview-container {
        width: 100%;
    }
    .custum-file-upload {
        width: 100%;
    }
    #imagen-preview, #imagen-preview-update {
        height: 150px;
    }
}
