/* Document Page Styles */
.document-container {
    margin: 0 auto;
    padding: 20px 0;
    transition: opacity 0.2s ease;
    position: relative;
}

/* Badge Styles */
.badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 1.25em;  
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.badge-generated {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.badge-signed {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.badge-sent {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.badge-authorized {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.badge-default {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* Document Header Center */
.document-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* Table and Container Styles */
.table-document-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    max-height: 600px;
}

.table-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.details-table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: white;
}

.add-item-container {
    padding: 10px;
}

/* Totals Section */
.document-totals-section {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 16px;
}

.totals-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
    margin-left: auto;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.total-label {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.total-value {
    font-weight: 600;
    color: #212529;
    font-size: 14px;
}

.total-final {
    border-top: 2px solid #dee2e6;
    margin-top: 8px;
    padding-top: 12px;
}

.total-final .total-label {
    font-weight: 700;
    font-size: 16px;
    color: #212529;
}

.total-final .total-value {
    font-weight: 700;
    font-size: 16px;
    color: #0d6efd;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: #6c757d;
}

/* Separación entre elementos del documento */
.document-container > * {
    margin-bottom: 12px;
}

.document-container > *:last-child {
    margin-bottom: 0;
}

/* Botón de regresar en esquina superior izquierda */
.document-back-button-container {
    position: absolute;
    top: 4px;
    left: 0;
    z-index: 10;
}

.document-header-back-button {
    margin: 0 10px;
    font-weight: 600;
}

.document-container.navigating {
    opacity: 0.7;
}

.document-container.normal {
    opacity: 1;
}

/* Header Styles */
.document-header {
    background-image: linear-gradient(135deg, color-mix(in srgb, var(--neutral-layer-2) 10%, var(--accent-fill-rest) 10%), color-mix(in srgb, var(--neutral-layer-2) 90%, var(--accent-fill-hover) 10%) );
    border: 2px solid var(--accent-fill-rest);
    border-radius: 12px;
    padding: 24px;
}

.document-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.document-header-buttons {
    display: flex;
    gap: 12px;
}

.document-title {
    font-family: monospace;
    margin: 0;
    color: red;
    font-size: 36px;
    font-weight: 700;
}

.document-subtitle {
    margin: 8px 0 0 0;
    color: var(--accent-fill-rest);
    font-size: 16px;
    font-weight: 500;
}

/* Content Container */
.document-content {
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.table-document-container {
    border-collapse: collapse;
    gap: 10px;
    border-radius: 0;
    box-shadow: none;
    padding: 0 !important;
    height: 550px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.details-table-container {
    width: 100%;
}

.document-content-title {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 12px;
}

.document-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Responsive grid para el header del documento */
.document-fields {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    width: 100%;
}

.document-section {
    display: flex;
    flex-direction: column;
}

.document-section-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
}

.document-fields {
    display: grid;
    gap: 20px;
}

.document-field {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Permite que el contenido se ajuste */
    flex: 1; /* Hace que cada campo ocupe el espacio disponible */
}

.document-field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.document-field-input {
    width: 100%;
    min-width: 0; /* Permite que se ajuste al contenido */
}

/* Estilos específicos para los campos del documento */
.document-field fluent-select,
.document-field fluent-text-field,
.document-field fluent-date-picker,
.document-field fluent-autocomplete {
    width: 100%;
    min-width: 0;
}

/* Navigation Styles */
.document-navigation {
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 24px;
}

.document-navigation-title {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 12px;
}

.document-navigation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.document-navigation-buttons {
    display: flex;
    gap: 12px;
}


.document-navigation-counter {
    text-align: center;
    padding: 12px 20px;
    background: var(--accent-fill-rest);
    border-radius: 8px;
}

.document-navigation-counter-text {
    font-weight: 600;
    font-size: 16px;
}

.document-navigation-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.document-navigation-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.document-navigation-selector-label {
    font-weight: 600;
    color: #374151;
    font-size: 16px;
}

.document-navigation-selector-input {
    width: 140px;
}

.document-navigation-go-button {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dialog Styles */
.document-dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.document-dialog-icon {
    width: 40px;
    height: 40px;
    background-color: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-dialog-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.document-dialog-body {
    padding: 16px 0;
}

.document-dialog-message {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.document-dialog-warning {
    padding: 12px;
    background-color: var(--neutral-fill-rest);
    border-left: 4px solid #dc2626;
}

.document-dialog-warning-text {
    margin: 0;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
}

/* Media queries para responsividad */
@media (max-width: 768px) {
    .document-content-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .document-fields {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .document-header-content {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .document-header-buttons {
        width: 100%;
        justify-content: flex-end;
    }
}

.document-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    
    p {
        margin: 0 !important;
        font-weight: 600;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding-top: 6px;
    }
}

.page-indicator {
    text-align: center !important;
    justify-content: center;
    display: flex;
    align-items: center;
}


/* Contenedor del botón de agregar */
.add-item-container {
    display: flex;
    justify-content: center;
}

.add-item-button {
    font-size: 14px;
    padding: 12px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-fill-rest), var(--accent-fill-hover));
    color: white;
    border: none;
    transition: all 0.2s ease;
    min-width: 200px;
}

.add-item-button:hover {
    background: linear-gradient(135deg, var(--accent-fill-hover), var(--accent-fill-active));
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}








/* Estado vacío */
.no-items-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
}

.empty-state fluent-icon {
    color: #9ca3af;
    font-size: 48px;
    animation: pulse 2s infinite;
}

.empty-state p {
    margin: 0;
    font-size: 16px;
    color: #6b7280;
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}



/* Mejoras para el estado de carga */
.document-container.loading {
    pointer-events: none;
    opacity: 0.7;
}

.document-container.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
}

/* Error Message Styles */
.document-error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    font-size: 0.9em;
    max-width: 100%;
    word-wrap: break-word;
}

.document-error-message .error-text {
    flex: 1;
    line-height: 1.4;
}

