/* GESTIÓN DOCUMENTAL v2 */
.card-gd {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.card-gd:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card-gd-header {
    padding: 10px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 15px;
}

.card-gd-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #666;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.card-gd-tools {
    display: flex;
    /* justify-content: space-between; */
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    font-size: 0.95rem;
}

.card-gd-body {
    padding: 20px;
}

.btn-gd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 8px;
}

.search-container-gd {
    position: relative;
    max-width: 400px;
}

.search-input-gd {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
    box-shadow: 0 5px 7px rgba(0, 0, 0, 0.1);
}

.search-input-gd:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.search-icon-gd {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

.documents-grid-gd {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.document-card-gd {
    cursor: pointer;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: var(--transition);
    overflow: hidden;
    border: 1px solid var(--light-gray);
    position: relative;
}

.document-card-gd.selected {
    background-color: var(--selected-color);
    border: 1px solid var(--primary-color);
}

.document-card-gd.selected .document-selection-indicator-gd {
    color: var(--primary-color);
}

.document-card-gd:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

#sendInvalid {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

.document-header-gd {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--light-gray);
    cursor: pointer;
    width: 100%;
    min-width: 0;
}

.document-selection-indicator-gd {
    color: #e0e0e0;
    font-size: 1.2rem;
    transition: var(--transition);
}

.document-icon-gd {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background-color: rgba(67, 97, 238, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.file-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

 .fallback-icon {
    background-color: rgba(39, 174, 96, 0.1);
}

.document-info-gd {
    flex: 1;
    min-width: 0;
}

.document-name-container {
    position: relative;
    margin-bottom: 4px;
}

.document-name-gd {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    width: 100%;
    min-width: 0;
    font-size: 0.9rem;
}

.document-details-gd {
    padding: 16px;
    font-size: 0.9rem;
}

.document-detail-gd {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.document-detail-gd:last-child {
    margin-bottom: 0;
}

.detail-label-gd {
    color: var(--gray-color);
}

.detail-value-gd {
    font-weight: 500;
}

.document-actions-gd {
    padding: 12px 16px;
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.action-btn-gd {
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    padding: 6px;
    border-radius: 4px;
}

.action-btn-gd:hover {
    color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.1);
}

.empty-state-gd {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-color);
}

.empty-icon-gd {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.filter-message-gd {
    text-align: center;
    padding: 20px;
    color: var(--gray-color);
    font-style: italic;
}

.document-info-gd {
    flex: 1;
    min-width: 0; /* Importante para contener elementos flexibles */
}

.document-name-container {
    position: relative;
    margin-bottom: 4px;
}

.filename-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    min-width: 0;
    padding-right: 5px;
    padding-top: 7px;
}

.edit-name-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.edit-name-btn:hover {
    color: #4361ee;
    background-color: rgba(67, 97, 238, 0.1);
}

/* Estilos para el modo edición */
.document-name-edit {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.name-input {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    min-width: 0;
    font-family: inherit;
}


.name-input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.edit-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.save-name-btn, .cancel-name-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.save-name-btn {
    color: #28a745;
}

.save-name-btn:hover {
    background-color: rgba(40, 167, 69, 0.1);
}

.cancel-name-btn {
    color: #dc3545;
}

.cancel-name-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

/* GESTIÓN DOCUMENTAL RELACIONADA v2 */
.related-documents-section {
    padding: 1rem 0;
}

.related-documents-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.related-documents-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.related-documents-title {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.related-documents-title h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.related-model-name {
    color: #4361ee;
    font-style: italic;
}

.related-documents-subtitle {
    color: #6c757d;
    font-size: 0.95rem;
}

.related-documents-body {
    padding: 0;
}

.related-accordion {
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    padding: 1.5rem;
}

.related-accordion-item {
    border-bottom: 1px solid #e9ecef;
}

.related-accordion-item:last-child {
    border-bottom: none;
}

.related-accordion-header {
    background: #f8f9fa;
    border: none;
}

.related-accordion-button {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: none;
    border: none;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2c3e50;
    font-weight: 500;
}

.related-accordion-button:hover {
    background: rgba(67, 97, 238, 0.05);
    color: #4361ee;
}

.related-accordion-button[aria-expanded="true"] {
    background: rgba(67, 97, 238, 0.1);
    color: #4361ee;
}

.accordion-item-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1rem;
}

.accordion-indicator {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.accordion-indicator i {
    transition: transform 0.3s ease;
}

.related-accordion-collapse {
    transition: all 0.3s ease;
}

.related-accordion-body {
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e9ecef;
}

/* Grid de documentos */
.related-documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* Items de documento */
.related-document-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
}

.related-document-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.15);
    transform: translateY(-2px);
}

.related-document-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 6px;
    margin-right: 1rem;
    flex-shrink: 0;
}

.related-document-icon i {
    font-size: 1.2rem;
}

.related-document-info {
    flex: 1;
    min-width: 0;
}

.related-document-name {
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.related-document-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6c757d;
}

.file-size, .file-date {
    display: flex;
    align-items: center;
}

.file-size::before {
    content: "📦";
    margin-right: 0.25rem;
}

.file-date::before {
    content: "🕒";
    margin-right: 0.25rem;
}

/* Acciones de documento */
.related-document-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-document-actions .action-btn-gd {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.related-document-actions .action-btn-gd:hover {
    color: #4361ee;
    background: rgba(67, 97, 238, 0.1);
}

.related-documents-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.related-documents-empty i {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.related-documents-empty p {
    margin: 0;
    font-size: 1.1rem;
}

.related-accordion-collapse {
    transition: height 0.3s ease;
}