/* ── Componente reutilizable: Panel de Adjuntos ── */

/* ── Overlay ── */
.adj-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.35);
    z-index: 2100;
    display: flex;
    justify-content: flex-end;
}

.adj-overlay.hidden {
    display: none;
}

/* ── Panel (drawer derecho) ── */
.adj-panel {
    background: #fff;
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.14);
}

/* ── Encabezado ── */
.adj-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.adj-header-info {
    min-width: 0;
}

.adj-titulo {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 2px;
}

.adj-subtitulo {
    font-size: 0.78rem;
    color: #6b7280;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 380px;
}

.adj-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 0 0 12px;
    line-height: 1;
    flex-shrink: 0;
}

.adj-close:hover {
    color: #374151;
}

/* ── Área de subida ── */
.adj-upload-area {
    border-bottom: 1px solid #f3f4f6;
    padding: 16px 24px;
    flex-shrink: 0;
    background: #fafafa;
}

.adj-file-row {
    margin-bottom: 10px;
}

.adj-file-label {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, background-color 0.15s;
}

.adj-file-label:hover {
    border-color: #6366f1;
    background: #f5f3ff;
}

.adj-file-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.adj-file-text {
    font-size: 0.85rem;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ocultar el input nativo */
.adj-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.adj-desc-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-family: inherit;
    box-sizing: border-box;
    color: #1f2937;
    background: #fff;
    margin-bottom: 10px;
}

.adj-desc-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

.adj-upload-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.adj-tipos-hint {
    font-size: 0.72rem;
    color: #9ca3af;
}

.adj-error {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 8px;
}

.adj-error.hidden {
    display: none;
}

/* ── Encabezado de la lista ── */
.adj-lista-header {
    padding: 12px 24px 4px;
    flex-shrink: 0;
}

.adj-lista-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Lista de archivos ── */
.adj-lista {
    flex: 1;
    overflow-y: auto;
    padding: 8px 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.adj-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 12px 14px;
}

.adj-item-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.adj-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.adj-item-nombre {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.adj-item-desc {
    font-size: 0.78rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.adj-item-meta {
    font-size: 0.72rem;
    color: #9ca3af;
}

/* ── Estados de la lista ── */
.adj-loading,
.adj-empty {
    font-size: 0.85rem;
    color: #9ca3af;
    text-align: center;
    margin: 0;
    padding: 24px 0;
}

.adj-error-load {
    font-size: 0.85rem;
    color: #dc2626;
    text-align: center;
    margin: 0;
    padding: 24px 0;
}

/* ── Badges de extensión ── */
.adj-ext-badge {
    flex-shrink: 0;
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    letter-spacing: 0.03em;
    min-width: 36px;
    text-align: center;
    margin-top: 1px;
}

.adj-ext-pdf  { background-color: #fee2e2; color: #991b1b; }
.adj-ext-doc,
.adj-ext-docx { background-color: #dbeafe; color: #1e40af; }
.adj-ext-xls,
.adj-ext-xlsx { background-color: #dcfce7; color: #166534; }
.adj-ext-png,
.adj-ext-jpg,
.adj-ext-jpeg { background-color: #f3e8ff; color: #6b21a8; }

/* ── Contenedor de acciones por ítem ── */
.adj-item-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    align-items: stretch;
}

/* ── Botón descargar en lista ── */
.btn-row-download {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-row-download:hover {
    background-color: #dbeafe;
}

/* ── Botón eliminar en lista ── */
.btn-row-delete {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-row-delete:hover {
    background-color: #fee2e2;
}

/* ── Botón adjuntos en tablas ── */
.btn-row-adjuntos {
    background-color: #fefce8;
    color: #854d0e;
    border-color: #fde68a;
}

.btn-row-adjuntos:hover {
    background-color: #fef9c3;
}

/* Responsive */
@media (max-width: 540px) {
    .adj-panel {
        max-width: 100%;
    }

    .adj-header,
    .adj-upload-area,
    .adj-lista-header,
    .adj-lista {
        padding-left: 16px;
        padding-right: 16px;
    }

    .adj-item-nombre,
    .adj-item-desc {
        max-width: 160px;
    }
}
