/* ══════════════════════════════════════════════════════
   PROAM — Programación Anual de Mantenimiento
   Complementa masterdata.css (paleta y radios compartidos).
   Prefijo: proam-
   ══════════════════════════════════════════════════════ */

/* ── Paleta de estados de conservación (PLACEHOLDER) ──────────────────
   Si ya tienes colores definidos con el arquitecto, solo cambia estos
   5 valores — todo el módulo (badges + leyenda) los toma de aquí.    */
:root {
    --proam-mb: #16a34a; /* Muy Bueno */
    --proam-b:  #2563eb; /* Bueno — azul (antes #65a30d, muy parecido al verde de Muy Bueno) */
    --proam-r:  #eab308; /* Regular */
    --proam-m:  #f97316; /* Malo */
    --proam-mm: #dc2626; /* Muy Malo */
}

/* ── Leyenda de estados ───────────────────────────────────────────────── */
.proam-leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    align-items: center;
}

.proam-leyenda-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}

.proam-leyenda-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}

    .proam-leyenda-dot.mb { background: var(--proam-mb); }
    .proam-leyenda-dot.b  { background: var(--proam-b); }
    .proam-leyenda-dot.r  { background: var(--proam-r); }
    .proam-leyenda-dot.m  { background: var(--proam-m); }
    .proam-leyenda-dot.mm { background: var(--proam-mm); }

/* ── Badges de estado (tabla + banner del modal) ─────────────────────── */
.proam-badge-estado {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
}

    .proam-badge-estado.mb { background: var(--proam-mb); }
    .proam-badge-estado.b  { background: var(--proam-b); }
    .proam-badge-estado.r  { background: var(--proam-r); color: #1f2937; }
    .proam-badge-estado.m  { background: var(--proam-m); }
    .proam-badge-estado.mm { background: var(--proam-mm); }

/* ── Card de filtros (IPRESS + Año + Cargar) ─────────────────────────── */
.proam-filtros-card {
    padding: 0.9rem 1.25rem;
}

.proam-filtros {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

    .proam-filtros .md-field {
        flex: 1 1 260px;
        min-width: 200px;
        max-width: 420px;
    }

.proam-field-anio {
    flex: 0 0 140px !important;
    min-width: 110px !important;
}

.proam-filtros .md-btn-primary {
    flex: 0 0 auto;
    height: 42px;
    white-space: nowrap;
}

/* ── Banner readonly del elemento seleccionado (dentro del modal) ───── */
.proam-banner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    margin-bottom: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.proam-banner-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.proam-banner-field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1 1 140px;
    min-width: 110px;
}

.proam-banner-field-lg {
    flex: 2 1 220px;
}

.proam-banner-lbl {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #64748b;
}

.proam-banner-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

.proam-codigo {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-weight: 700;
    color: #2563eb;
}

/* ── Selector de actividad del catálogo ──────────────────────────────── */
.proam-catalogo-hint {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.3rem;
}

/* ── Campo Frecuencia (más angosto en desktop) ───────────────────────── */
.proam-field-freq {
    flex: 0 0 160px;
}

/* ── Grid de semanas: 12 meses × 4 semanas ───────────────────────────── */
.proam-semanas-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    margin: 1.1rem 0 0.75rem;
}

.proam-semanas-warn {
    font-weight: 500;
    color: #dc2626;
    font-size: 0.78rem;
    margin-left: 0.4rem;
}

.proam-semanas-hint {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.78rem;
    margin-left: 0.4rem;
}

.proam-semanas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.proam-mes {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.55rem 0.6rem;
}

.proam-mes-nombre {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 0.4rem;
}

.proam-semanas-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
}

.proam-semana-btn {
    padding: 0.4rem 0;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    background: #fff;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

    .proam-semana-btn:hover {
        border-color: #93c5fd;
        background: #eff6ff;
    }

    .proam-semana-btn.activa {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
        box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
    }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .proam-semanas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .proam-filtros {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .proam-filtros .md-field,
    .proam-field-anio {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: none !important;
        width: 100%;
    }

    .proam-filtros .md-btn-primary {
        width: 100%;
        justify-content: center;
    }

    .proam-banner-row {
        gap: 0.75rem;
    }

    .proam-banner-field {
        flex: 1 1 45%;
    }
}

@media (max-width: 480px) {
    .proam-semanas-grid {
        grid-template-columns: 1fr;
    }

    .proam-mes {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .proam-mes-nombre {
        margin-bottom: 0;
        flex: 0 0 46px;
    }

    .proam-semanas-row {
        flex: 1;
    }

    .proam-banner-field {
        flex: 1 1 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROAM BIENES — agregar este bloque al final de proam.css existente.

   OJO: no tengo el proam.css real del proyecto (no vino en el zip), así que
   estas reglas son autocontenidas y no dependen de variables que no pude
   confirmar. Si en tu proam.css ya existen variables de color/espaciado
   (ej. --proam-primary, --md-radius, etc.) reemplaza los valores sueltos de
   abajo por esas variables para que quede 100% consistente con el resto.
   ═══════════════════════════════════════════════════════════════════════════ */

.proam-bienes-section {
    margin: 1.25rem 0;
    border: 1px solid #e2e5eb;
    border-radius: 10px;
    overflow: hidden;
}

.proam-bienes-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f7f8fa;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2937;
    text-align: left;
}

.proam-bienes-chevron {
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease;
}

    .proam-bienes-chevron.abierto {
        transform: rotate(180deg);
    }

.proam-bienes-count {
    margin-left: auto;
    background: #e5e7eb;
    color: #374151;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.proam-bienes-body {
    padding: 1rem;
}

.proam-btn-agregar-producto {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
}

    .proam-btn-agregar-producto:hover {
        background: #4338ca;
    }

    .proam-btn-agregar-producto svg {
        width: 18px;
        height: 18px;
    }

.proam-bienes-table {
    width: 100%;
}

.proam-bienes-empty {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0.5rem 0 0;
}

.proam-act-quitar {
    color: #dc2626;
}

    .proam-act-quitar:hover {
        background: #fee2e2;
    }

/* ── Sub-modal Agregar/Editar Producto ────────────────────────────────────── */

.proam-submodal-backdrop {
    z-index: 1100;
}

.proam-modal-bien {
    z-index: 1101;
    max-width: 560px;
}

.proam-bien-buscador {
    position: relative;
}

.proam-bien-buscando {
    padding: 0.75rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.proam-bien-resultados {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e2e5eb;
    border-radius: 8px;
    margin-top: 0.4rem;
}

.proam-bien-resultado-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: #fff;
    border: none;
    border-bottom: 1px solid #f0f1f3;
    cursor: pointer;
    text-align: left;
}

    .proam-bien-resultado-item:last-child {
        border-bottom: none;
    }

    .proam-bien-resultado-item:hover,
    .proam-bien-resultado-item.activo {
        background: #eef2ff;
    }

.proam-bien-resultado-nombre {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
}

.proam-bien-resultado-meta {
    font-size: 0.78rem;
    color: #6b7280;
}

.proam-bien-precio-ref {
    display: block;
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.proam-bien-error {
    color: #dc2626;
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROAM BIENES — ajustes de la revisión 2 (resumen en modal principal,
   sub-modal gestor con lista embebida, stepper propio, selección con check).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Resumen compacto en el modal principal (ya no hay tabla editable ahí) ─── */

.proam-bienes-resumen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.proam-bienes-chip {
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
}

.proam-bienes-chip-mas {
    background: #f3f4f6;
    color: #4b5563;
}

.proam-bienes-total {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: #1f2937;
}

.proam-bienes-total-modal {
    text-align: right;
    padding: 0.6rem 0.25rem 0;
    font-size: 0.95rem;
}

/* ── Sub-modal más grande ─────────────────────────────────────────────────── */

.proam-modal-bien {
    max-width: 760px;
    width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
}

.proam-bien-form-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.proam-bien-cancelar-edicion {
    background: none;
    border: none;
    color: #4f46e5;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
}

.proam-bien-lista-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 1.25rem 0 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e5eb;
}

.proam-bien-btn-confirmar {
    margin: 0.5rem 0 0.25rem;
}

/* ── Selección de producto — check visible, no solo un color tenue ──────────── */

.proam-bien-resultado-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.proam-bien-resultado-texto {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.proam-bien-resultado-item.activo {
    background: #eef2ff;
    border-left: 3px solid #4f46e5;
}

.proam-bien-check {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #4f46e5;
}

.proam-bien-resultado-item.ya-agregado {
    opacity: 0.5;
    cursor: not-allowed;
}

.row-editando {
    background: #fffbeb;
}

/* ── Stepper de Cantidad (reemplaza las flechas nativas del navegador) ──────── */

.proam-stepper {
    display: flex;
    align-items: stretch;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}

.proam-stepper-btn {
    width: 36px;
    background: #f3f4f6;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
}

    .proam-stepper-btn:hover {
        background: #e5e7eb;
    }

.proam-stepper-input {
    flex: 1;
    border: none;
    text-align: center;
    padding: 0.5rem 0.25rem;
    font-size: 0.95rem;
    min-width: 0;
}

    .proam-stepper-input:focus {
        outline: none;
    }

    /* Oculta las flechas nativas del navegador en todos los inputs numéricos de
   este módulo — con esto ya no puede repetirse el bug de "1.0001" al usarlas. */
    .proam-stepper-input::-webkit-outer-spin-button,
    .proam-stepper-input::-webkit-inner-spin-button,
    .md-modal input[type="number"]::-webkit-outer-spin-button,
    .md-modal input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

.proam-stepper-input,
.md-modal input[type="number"] {
    -moz-appearance: textfield;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROAM BIENES — ajustes de la revisión 3.
   - Modal principal de Proam más grande.
   - Sub-modal de Bienes más compacto (ya no hace falta tan grande: el
     buscador se colapsa apenas eliges un producto, así que nunca conviven
     la lista de resultados y el formulario de cantidad/precio a la vez).
   - Buscador no muestra nada hasta que escribes.
   - Selección con check animado, más suave que el borde sólido anterior.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Modal principal de Proam — más grande, como se pidió ────────────────── */

.proam-modal-xl {
    max-width: 980px;
    width: 95vw;
    max-height: 92vh;
}

/* ── Sub-modal de Bienes — más chico, un solo scroll (el de la lista) ───── */

.proam-modal-bien {
    max-width: 760px;
    width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
}

/* ── Hint cuando el buscador está vacío ──────────────────────────────────── */

.proam-bien-hint {
    padding: 0.6rem 0.1rem;
    color: #6b7280;
    font-size: 0.85rem;
}

/* ── Chip de producto seleccionado (buscador colapsado) ──────────────────── */

.proam-bien-seleccionado {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.5rem;
}

.proam-bien-seleccionado-nombre {
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.proam-bien-cambiar {
    background: none;
    border: none;
    color: #4f46e5;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.proam-bien-cambiar:hover {
    text-decoration: underline;
}

/* ── Selección con check animado — reemplaza el borde sólido tosco ──────── */

.proam-bien-check-slot {
    width: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.proam-bien-resultado-item {
    transition: background 0.15s ease, box-shadow 0.15s ease;
    border-radius: 6px;
}

.proam-bien-resultado-item.activo {
    background: #eef2ff;
    box-shadow: inset 3px 0 0 0 #6366f1;
    border-left: none; /* la versión anterior usaba border-left sólido, ahora es sombra suave */
}

@keyframes proamCheckPop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.proam-bien-check {
    animation: proamCheckPop 0.22s ease-out;
}

/* ── Campos calculados de solo lectura (Consumo M.O., Costo M.O., etc.) ──── */
.proam-readonly {
    background: #f1f5f9;
    color: #475569;
    cursor: default;
}

/* ── Estado "todo programado" — variante positiva de .md-state-box ───────── */
.proam-todo-ok {
    color: #15803d;
}

.proam-todo-ok svg {
    fill: #22c55e;
}

.proam-todo-ok p {
    color: #166534;
    font-weight: 500;
}

.proam-todo-ok .md-btn-ghost {
    margin-top: 0.5rem;
}

/* ── Estado de bienvenida antes de cargar (evita pantalla en blanco) ─────── */
.proam-bienvenida {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3.5rem 2rem;
    gap: 0.75rem;
}

.proam-bienvenida svg {
    width: 48px;
    height: 48px;
    fill: #cbd5e1;
}

.proam-bienvenida p {
    color: #64748b;
    font-size: 0.95rem;
    max-width: 380px;
    margin: 0;
}
