﻿/* ── Banner y encabezado NDP ── */
.ndp-banner {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.ndp-header {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

    .ndp-header h3 {
        color: var(--color-primary);
        font-size: 1.2rem;
        font-weight: 600;
        margin-bottom: 0.25rem;
    }

.ndp-promo-text {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

/* ── Sección colapsable ── */
.seccion-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1.5px solid var(--color-border-light);
    transition: border-color var(--transition);
}

    .seccion-card.tiene-items {
        border-color: var(--color-primary-btn);
    }

.seccion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    cursor: pointer;
    user-select: none;
    background: var(--color-primary-nav);
    transition: background var(--transition);
}

    .seccion-header:hover {
        background: var(--color-primary);
    }

.seccion-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.seccion-titulo {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
}


.seccion-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.seccion-chevron {
    font-size: 0.75rem;
    color: #c5d3f0;
    transition: transform var(--transition);
}

    .seccion-chevron.abierto {
        transform: rotate(180deg);
    }

.seccion-body {
    padding: 0.75rem;
    border-top: 1px solid var(--color-border-light);
}

/* ── Toggle vista ── */
.vista-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    justify-content: flex-end;
}

.vista-btn {
    background: transparent;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all var(--transition);
}

    .vista-btn.activo {
        background: var(--color-primary-btn);
        border-color: var(--color-primary-btn);
        color: white;
    }

/* ── Producto Card ── */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.producto-card {
    background: var(--color-bg-card);
    border: 1.5px solid var(--color-border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
    position: relative;
}

    .producto-card.en-pedido {
        border-color: var(--color-primary-btn);
        box-shadow: 0 0 0 3px rgba(61, 101, 196, 0.12);
    }

.producto-card-img-wrap {
    position: relative;
    background: #f8f9fc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    cursor: pointer;
}

.producto-card-img {
    width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.producto-badge-dto {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--color-warning);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
}

.producto-card-body {
    padding: 0.6rem 0.75rem;
}

.producto-nombre {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 2px;
    line-height: 1.3;
}

.producto-codigo {
    font-size: 0.7rem;
    color: var(--color-text-light);
    margin-bottom: 0.4rem;
}

.producto-precio-tachado {
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-decoration: line-through;
}

.producto-precio {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
}

.producto-cantidad {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.5rem;
}

.btn-cantidad {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}

    .btn-cantidad:hover {
        background: var(--color-primary-light);
    }

.input-cantidad {
    flex: 1;
    min-width: 0;
    height: 28px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.85rem;
    padding: 0 4px;
    color: var(--color-text);
    background: var(--color-bg-card);
}

    .input-cantidad:focus {
        outline: none;
        border-color: var(--color-primary-btn);
    }

/* ── Producto Lista ── */
.productos-lista {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.producto-fila {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-bg-card);
    border: 1.5px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    transition: border-color var(--transition);
}

    .producto-fila.en-pedido {
        border-color: var(--color-primary-btn);
        background: #f0f4ff;
    }

.producto-fila-img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.producto-fila-info {
    min-width: 0;
}

.producto-fila-precio {
    text-align: right;
    min-width: 70px;
}

.producto-fila-cantidad {
    min-width: 110px;
}

/* ── Modal imagen ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-img-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.modal-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

/* ── Desktop ── */
@media (min-width: 769px) {
    .productos-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .producto-card-img {
        max-height: 160px;
    }
}

@media (max-width: 768px) {
    .productos-lista .producto-fila {
        grid-template-columns: 80px 1fr;
        gap: 0.5rem;
    }

    .productos-lista .producto-fila-img {
        width: 72px;
        height: 72px;
        grid-row: 1 / 4;
        align-self: center;
    }

    .productos-lista .producto-fila-info {
        grid-column: 2;
    }

    .productos-lista .producto-fila-precio {
        grid-column: 2;
        text-align: left;
    }

    .productos-lista .producto-fila-cantidad {
        grid-column: 2;
    }

    .productos-lista .producto-nombre {
        font-size: 0.75rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

.banner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.banner-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.banner-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.banner-titulo {
    color: var(--color-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.banner-texto {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.banner-actions {
    display: flex;
    gap: 0.75rem;
}

    .banner-actions .btn {
        flex: 1;
    }

/* Panel de secciones existentes */
.ndp-secciones-info {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.ndp-seccion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

    .ndp-seccion-item:last-child {
        border-bottom: none;
    }

.ndp-seccion-orden {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    width: 24px;
    text-align: center;
    background: var(--color-bg-section);
    border-radius: var(--radius-sm);
    padding: 2px 0;
}

.ndp-seccion-titulo {
    font-size: 0.9rem;
    color: var(--color-text);
}

/* Preview Excel */
.ndp-codigos-faltantes {
    display: flex;
    flex-wrap: wrap;
}

.ndp-preview-seccion {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.ndp-preview-seccion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    background: var(--color-bg-section);
    transition: background var(--transition);
}

    .ndp-preview-seccion-header:hover {
        background: var(--color-primary-light);
    }

.ndp-preview-titulo {
    font-weight: 600;
    color: var(--color-text);
}

.ndp-preview-chevron {
    display: inline-block;
    transition: transform var(--transition);
    color: var(--color-text-muted);
}

    .ndp-preview-chevron.abierta {
        transform: rotate(180deg);
    }

.ndp-preview-seccion-body {
    padding: 0;
    border-top: 1px solid var(--color-border-light);
}

/* ===========================
   Notas de Pedido — Intranet
   =========================== */

.npx-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1280px;
}

/* Header de página */
.npx-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.npx-page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1f2e;
    margin: 0;
}

.npx-page-actions {
    display: flex;
    gap: 0.5rem;
}

/* Toolbar (filtros del listado) */
.npx-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.npx-search {
    flex: 1;
    min-width: 240px;
    max-width: 480px;
}

/* Cards */
.npx-card {
    background: #fff;
    border: 1px solid #e5e7ef;
    border-radius: 10px;
    padding: 1.25rem;
}

.npx-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.npx-card-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7a99;
    margin: 0;
}

/* Form layout */
.npx-form-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .npx-form-grid {
        grid-template-columns: 1fr;
    }
}

.npx-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

    .npx-field:last-child {
        margin-bottom: 0;
    }

.npx-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7a99;
    letter-spacing: 0.02em;
}

.npx-field-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

    .npx-field-row > .npx-field {
        flex: 1;
        margin-bottom: 0;
    }

.npx-form-control {
    width: 100%;
    border: 1px solid #e5e7ef;
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
    color: #1a1f2e;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .npx-form-control:focus {
        outline: none;
        border-color: #00136f;
        box-shadow: 0 0 0 3px rgba(0, 19, 111, 0.08);
    }

    .npx-form-control.invalid {
        border-color: #dc2626;
    }

.npx-field-error {
    font-size: 0.75rem;
    color: #dc2626;
}

/* Switch */
.npx-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #1a1f2e;
    cursor: pointer;
    user-select: none;
}

    .npx-switch input[type="checkbox"] {
        appearance: none;
        width: 36px;
        height: 20px;
        background: #c4cde0;
        border-radius: 99px;
        position: relative;
        cursor: pointer;
        transition: background 0.15s;
    }

        .npx-switch input[type="checkbox"]::after {
            content: "";
            position: absolute;
            top: 2px;
            left: 2px;
            width: 16px;
            height: 16px;
            background: #fff;
            border-radius: 50%;
            transition: transform 0.15s;
        }

        .npx-switch input[type="checkbox"]:checked {
            background: #00136f;
        }

            .npx-switch input[type="checkbox"]:checked::after {
                transform: translateX(16px);
            }

/* Imagen drop más compacto */
.npx-img-drops {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* Listado de NPs */
.npx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

    .npx-table th {
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #6b7a99;
        text-align: left;
        padding: 0.65rem 0.75rem;
        border-bottom: 1px solid #e5e7ef;
        background: #fafbfd;
    }

    .npx-table td {
        padding: 0.65rem 0.75rem;
        border-bottom: 1px solid #f3f4f8;
        color: #1a1f2e;
    }

    .npx-table tr:last-child td {
        border-bottom: none;
    }

    .npx-table tbody tr {
        transition: background 0.1s;
    }

        .npx-table tbody tr:hover {
            background: #fafbfd;
        }

.npx-table-id {
    color: #6b7a99;
    font-variant-numeric: tabular-nums;
    width: 70px;
}

.npx-table-actions {
    width: 220px;
    text-align: right;
    white-space: nowrap;
}

/* Badges de estado */
.npx-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 99px;
    letter-spacing: 0.02em;
}

    .npx-badge.activa {
        background: #dcfce7;
        color: #166534;
    }

    .npx-badge.inactiva {
        background: #f3f4f8;
        color: #6b7a99;
    }

/* Lista de secciones existentes (chips) */
.npx-secciones-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.npx-seccion-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #eef1fb;
    border: 1px solid #d6deef;
    border-radius: 99px;
    padding: 0.25rem 0.75rem 0.25rem 0.4rem;
    font-size: 0.8rem;
    color: #1a1f2e;
}

.npx-seccion-chip-num {
    background: #00136f;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.npx-secciones-empty {
    font-size: 0.85rem;
    color: #6b7a99;
}

/* Preview Excel */
.npx-preview-warnings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.npx-preview-warning {
    border: 1px solid;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

    .npx-preview-warning.danger {
        background: #fef2f2;
        border-color: #fecaca;
        color: #991b1b;
    }

    .npx-preview-warning.warning {
        background: #fffbeb;
        border-color: #fde68a;
        color: #92400e;
    }

.npx-preview-warning-title {
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.npx-codigos-faltantes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.npx-codigo-chip {
    background: #fff;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.75rem;
    padding: 1px 8px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}

.npx-preview-secciones {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.npx-preview-seccion {
    background: #fff;
    border: 1px solid #e5e7ef;
    border-radius: 10px;
    overflow: hidden;
}

.npx-preview-seccion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
}

    .npx-preview-seccion-header:hover {
        background: #fafbfd;
    }

.npx-preview-seccion-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.npx-preview-chevron {
    font-size: 0.7rem;
    color: #6b7a99;
    transition: transform 0.15s;
}

    .npx-preview-chevron.abierta {
        transform: rotate(180deg);
    }

.npx-preview-titulo {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1f2e;
}

    .npx-preview-titulo.sin-titulo {
        color: #9aa0b4;
        font-style: italic;
        font-weight: 500;
    }

.npx-preview-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7a99;
    background: #f3f4f8;
    padding: 2px 8px;
    border-radius: 99px;
}

.npx-preview-seccion-body {
    border-top: 1px solid #e5e7ef;
}

.npx-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

    .npx-preview-table th {
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #6b7a99;
        text-align: left;
        padding: 0.5rem 1rem;
        background: #fafbfd;
        border-bottom: 1px solid #e5e7ef;
    }

    .npx-preview-table td {
        padding: 0.45rem 1rem;
        border-bottom: 1px solid #f3f4f8;
        color: #1a1f2e;
    }

    .npx-preview-table tr:last-child td {
        border-bottom: none;
    }

.npx-preview-codigo {
    color: #6b7a99;
    font-variant-numeric: tabular-nums;
    width: 110px;
}

/* Empty state */
.npx-empty {
    text-align: center;
    padding: 2rem;
    color: #6b7a99;
    font-size: 0.875rem;
}

.npx-loading {
    text-align: center;
    padding: 2rem;
    color: #6b7a99;
    font-size: 0.875rem;
}

/* Drop zone compacta */
.npx-dropzone {
    position: relative;
    border: 2px dashed #c4cde0;
    border-radius: 10px;
    background: #fafbfd;
    transition: border-color 0.15s, background 0.15s;
    overflow: hidden;
}

    .npx-dropzone.empty {
        min-height: 110px;
    }

    .npx-dropzone.filled {
        border-style: solid;
        border-color: #e5e7ef;
        background: #fff;
    }

    .npx-dropzone:hover, .npx-dropzone.drag-over {
        border-color: #00136f;
        background: #eef1fb;
    }

.npx-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.npx-dropzone-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    pointer-events: none;
}

.npx-dropzone-icon {
    font-size: 1.4rem;
    color: #00136f;
}

.npx-dropzone-label {
    font-weight: 600;
    color: #1a1f2e;
    font-size: 0.875rem;
}

.npx-dropzone-hint {
    font-size: 0.75rem;
    color: #6b7a99;
    margin-left: auto;
}

.npx-dropzone-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    min-height: 110px;
    max-height: 180px;
}

    .npx-dropzone-preview img {
        max-width: 100%;
        max-height: 160px;
        object-fit: contain;
        border-radius: 6px;
    }

.npx-dropzone-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 31, 46, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.npx-dropzone:hover .npx-dropzone-overlay {
    opacity: 1;
}

.npx-dropzone-overlay-text {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.npx-dropzone-clear {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 3;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7ef;
    color: #6b7a99;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: color 0.15s, border-color 0.15s;
}

    .npx-dropzone-clear:hover {
        color: #dc2626;
        border-color: #fecaca;
    }

.npx-quill-wrapper {
    border: 1px solid #e5e7ef;
    border-radius: 6px;
    overflow: hidden;
}

    .npx-quill-wrapper .ql-toolbar.ql-snow {
        border: none;
        border-bottom: 1px solid #e5e7ef;
        background: #fafbfd;
    }

    .npx-quill-wrapper .ql-container.ql-snow {
        border: none;
        min-height: 180px;
        font-family: var(--font-main);
        font-size: 0.9rem;
    }

/* Soporte para HTML generado por Quill */
.ql-align-center {
    text-align: center;
}

.ql-align-right {
    text-align: right;
}

.ql-align-justify {
    text-align: justify;
}

.ql-size-small {
    font-size: 0.75em;
}

.ql-size-large {
    font-size: 1.5em;
}

.ql-size-huge {
    font-size: 2.5em;
}