.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    display: none;
}

.timeline-item {
    position: relative;
    padding-bottom: 30px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -17px;
    top: 9px;
    bottom: -15px;
    /* Empalme perfecto con el centro del siguiente nodo */
    width: 2px;
    background: #e9ecef;
    z-index: 1;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-marker {
    position: absolute;
    left: -26px;
    top: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #e9ecef;
    z-index: 2;
    background-color: #fff;
    /* Fallback si no tiene clase bg-* */
}

.timeline-item.active .timeline-marker {
    width: 22px;
    height: 22px;
    left: -28px;
    box-shadow: 0 0 0 3px #e9ecef;
}

/* Chat Styles - V8.Vantage (Premium Design) */
#chatContainer {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background-color: #f8fafc; /* gray-50 */
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.chat-scrollable {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}


.chat-message {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
}

.chat-message-container {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

/* User (Citizen) messages - Right side (Mine) */
.chat-message.user-message {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message.user-message .chat-message-container {
    background-color: var(--primary-burgundy);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
    margin-left: auto;
}

.chat-message.user-message .chat-message-time,
.chat-message.user-message .chat-message-sender {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Staff messages - Left side (Other) */
.chat-message.staff-message {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-message.staff-message .chat-message-container {
    background-color: white;
    border: 1px solid var(--gray-200);
    color: var(--gray-800);
    border-bottom-left-radius: var(--radius-sm);
    margin-right: auto;
}

.chat-message-info {
    font-size: 0.75rem;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.staff-message .chat-message-info {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.chat-message-sender {
    font-weight: 700;
}

.chat-message-time {
    font-size: 0.7rem;
    color: var(--gray-500);
}

.chat-message-bubble {
    font-size: 0.95rem;
    line-height: 1.5;
}

.extra-small {
    font-size: 0.65rem;
}

.scroll-invisible::-webkit-scrollbar {
    display: none;
}
.scroll-invisible {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Chat File Preview */
.chat-file-preview {
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-file-preview .bg-light {
    background-color: #f8f9fa !important;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-sending {
    opacity: 0.75;
}

.chat-message-attachment .view-doc-btn {
    border-color: var(--primary-burgundy) !important;
    color: #000000 !important;
    background-color: #ffffff !important;
    font-weight: 500;
}

.chat-message-attachment .view-doc-btn i {
    color: var(--primary-burgundy);
}

.chat-message-attachment .view-doc-btn:hover {
    border-color: var(--primary-burgundy) !important;
    background-color: var(--primary-burgundy) !important;
    color: #ffffff !important;
}

.message-error .chat-message-container {
    border: 1px solid var(--danger);
}

.message-error-text {
    font-size: 0.7rem;
    color: #dc3545;
    margin-top: 2px;
}

.sending-loader {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Premium Dynamic Sections V22.2 */
.bg-success-soft {
    background-color: rgba(40, 167, 69, 0.1) !important;
    color: #1e7e34;
}

.bg-info-soft {
    background-color: rgba(23, 162, 184, 0.1) !important;
    color: #117a8b;
}

.bg-burgundy-soft {
    background-color: rgba(122, 46, 61, 0.1) !important;
    color: #7a2e3d;
}

.border-left-success {
    border-left: 5px solid #28a745 !important;
}

.border-left-info {
    border-left: 5px solid #17a2b8 !important;
}

.border-left-burgundy {
    border-left: 5px solid #7a2e3d !important;
}

.pulse-button {
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0px rgba(40, 167, 69, 0.4);
    }

    100% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
}

.transition-all {
    transition: all 0.3s ease;
}

.hover-shadow:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.bg-light-warning {
    background-color: #fffef0;
}

.text-burgundy {
    color: #7a2e3d;
}

.btn-burgundy {
    background-color: #7a2e3d;
    color: white;
    border: none;
}

.btn-burgundy:hover {
    background-color: #5d232e;
    color: white;
}

.btn-outline-burgundy {
    border-color: #7a2e3d;
    color: #7a2e3d;
}

.btn-outline-burgundy:hover {
    background-color: #7a2e3d;
    color: white;
}

/* Utility Classes for V8 Compliance */
.floating-container-offset {
    margin-top: -3.5rem;
    position: relative;
    z-index: 10;
}

.document-icon-container {
    width: 60px;
}

/* Invisible Scroll Utilities */
.scroll-invisible {
    overflow-y: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.scroll-invisible::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

/* Chat Scroll Logic - Limitar a 4 mensajes aprox */
.chat-scrollable {
    max-height: 400px;
    /* Aproximadamente 4 mensajes */
    padding-right: 5px;
}

/* Timeline Scroll Logic - Limitar a 3 entradas aprox */
.timeline-scrollable {
    max-height: 220px;
    /* Reducido a ~3 ítems según especificación del usuario */
    position: relative;
    padding-top: 5px;
    padding-bottom: 5px;
    overflow-x: hidden;
}

/* Document Viewer Premium Style */
.rounded-4 { border-radius: 1rem !important; }
.shadow-premium { box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important; }
.bg-soft-burgundy { background-color: rgba(122, 46, 61, 0.08) !important; }

.modal-viewer-body {
    min-height: 500px;
    background-color: #f8f9fa;
    background-image: radial-gradient(#d1d1d1 0.5px, transparent 0.5px);
    background-size: 10px 10px;
}

.big-icon {
    font-size: 3rem;
}

.hover-pointer {
    cursor: pointer;
}

.transition-3 {
    transition: all 0.3s;
}

/* Offset para la vista de mis tramites (reemplaza style inline) */
.submissions-offset-container {
    margin-top: -3rem;
}

/* Document Card Action Buttons Hover */
.documents-container .view-doc-btn:hover {
    background-color: #f0f7ff !important;
    border-color: #0d6efd !important;
}

.documents-container .view-doc-btn:hover i {
    transform: scale(1.1);
}

.documents-container .download-doc-btn:hover {
    background-color: #fff5f5 !important;
    border-color: var(--primary-burgundy) !important;
}

.documents-container .download-doc-btn:hover i {
    transform: scale(1.1);
}

.view-doc-btn, .download-doc-btn {
    transition: all 0.2s ease;
}