/* Comercial ESDI — estilos custom */

body {
    font-size: 0.92rem;
}

main.container-fluid {
    max-width: 1800px;
}

/* Pipeline kanban */
.pipeline-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

.pipeline-column {
    flex: 0 0 280px;
    background-color: #f1f3f5;
    border-radius: 0.5rem;
    padding: 0.5rem;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.pipeline-column-header {
    padding: 0.25rem 0.5rem 0.5rem;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
}

.pipeline-column-body {
    flex: 1;
    overflow-y: auto;
}

.pipeline-card {
    cursor: pointer;
    transition: box-shadow 0.15s ease;
    position: relative;
}
.pipeline-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
}

/* Drag & drop (SortableJS) */
.pipeline-card-ghost {
    opacity: 0.45;
    background: #e7f1ff;
    border: 1px dashed #0d6efd;
}
.pipeline-card.sortable-chosen { cursor: grabbing; }
.pipeline-column-body.js-stage-list { min-height: 40px; }   /* permite soltar en columnas vacías */

/* HTMX indicators */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Modal stack-safe (forzamos z-index alto) */
#modal-container > .modal {
    z-index: 1080;
}

/* Columna kanban colapsada (etapas posición 9+) */
.pipeline-column-collapsed {
    flex: 0 0 44px;
    background-color: #e9ecef;
    border-radius: 0.5rem;
    padding: 0.5rem 0.25rem;
    max-height: calc(100vh - 200px);
    text-decoration: none;
    color: #495057;
    border: 1px solid #dee2e6;
    transition: background 0.15s, transform 0.15s;
    cursor: pointer;
    overflow: hidden;
}
.pipeline-column-collapsed:hover {
    background-color: #d6dadd;
    transform: scaleX(1.1);
    color: #212529;
}
.pipeline-column-collapsed .collapsed-name {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    line-height: 1.4;
    margin-top: 0.25rem;
}

/* Adjuntos */
.attachment-item {
    background: white;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}
.attachment-item:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}
.attachment-item img {
    transition: transform 0.2s ease;
}
.attachment-item img:hover {
    transform: scale(1.02);
}

/* Lightbox — el JS lo crea con inline styles, pero por si lo tematizamos */
#lightbox-backdrop {
    animation: lightbox-fade-in 0.15s ease;
}
@keyframes lightbox-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Ficha estilo Odoo (detalle de contacto / formularios) ──────────────── */
.o-control-panel .breadcrumb { font-size: 0.85rem; }

.o-sheet {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;            /* recorta la cinta "Archivado" en la esquina */
}

.o-form-title {
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
}

/* Avatar */
.o-avatar {
    width: 72px;
    height: 72px;
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #dee2e6;
}
.o-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    color: #adb5bd;
    font-size: 2rem;
}

/* Smart buttons (cajas de estadística arriba a la derecha) */
.o-stat-button {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    min-width: 118px;
    padding: 0.35rem 0.85rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    color: #495057;
    text-decoration: none;
    line-height: 1.25;
    transition: background 0.15s, border-color 0.15s;
}
.o-stat-button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}
.o-stat-button .o-stat-value { font-size: 1.15rem; font-weight: 700; }
.o-stat-button .o-stat-label { font-size: 0.75rem; color: #6c757d; }

/* Filas de campos label/valor */
.o-field {
    display: flex;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f1f3f5;
}
.o-field:last-child { border-bottom: 0; }
.o-field-label {
    flex: 0 0 130px;
    color: #6c757d;
    font-size: 0.85rem;
    padding-top: 0.05rem;
}
.o-field-value { flex: 1 1 auto; min-width: 0; word-break: break-word; }

/* Notebook (pestañas) */
.o-notebook .nav-link { color: #495057; }
.o-notebook .nav-link.active { font-weight: 600; }
.o-notes { white-space: normal; }

/* Cinta "Archivado" (esquina superior derecha de la hoja) */
.o-ribbon {
    position: absolute;
    top: 16px;
    right: -34px;
    transform: rotate(45deg);
    background: #dc3545;
    color: #fff;
    padding: 0.15rem 2.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    z-index: 3;
}

/* Utilidad usada por _attachments.html para que text-truncate funcione */
.min-w-0 { min-width: 0 !important; }
