/**
 * submissions.css — Estilos específicos del módulo de Solicitudes y Chat
 * Portal Ciudadano Sisvantec V8.3
 *
 * Clases globales removidas (viven en global.css o variables.css):
 *   .text-burgundy, .btn-burgundy, .btn-outline-burgundy,
 *   .bg-burgundy-soft, .bg-success-soft, .bg-info-soft,
 *   .transition-all, .hover-shadow, .extra-small, .text-xxs,
 *   .text-xxs-icon, .scroll-invisible, .rounded-4, .shadow-premium,
 *   .big-icon, .hover-pointer, .transition-3,
 *   .border-left-success, .border-left-info, .border-left-burgundy,
 *   .pulse-button
 */

/* ──────────────────────────────────────────
   Timeline de expediente
   ────────────────────────────────────────── */
.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: var(--gray-200);
    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: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2.5px solid var(--color-surface);
    box-shadow: 0 0 0 2px var(--gray-200);
    z-index: 2;
    background-color: var(--color-surface);
    transition: all 0.3s ease;
}

.timeline-item.active .timeline-marker {
    width: 20px;
    height: 20px;
    left: -28px;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
    border-color: var(--color-surface);
}

/* ──────────────────────────────────────────
   Chat — V8.Vantage (Premium Design)
   ────────────────────────────────────────── */
#chatContainer {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background-color: var(--gray-50);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.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: 80%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xl);
    position: relative;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: var(--transition-base);
}

/* Mensajes del ciudadano — derecha */
.chat-message.user-message {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message.user-message .chat-message-container {
    background-color: var(--color-primary);
    color: var(--color-surface);
    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;
}

/* Mensajes del staff — izquierda */
.chat-message.staff-message {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-message.staff-message .chat-message-container {
    background-color: var(--color-surface);
    border: 1px solid var(--gray-200);
    color: var(--color-text-primary);
    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;
}

/* ──────────────────────────────────────────
   Chat — Vista de scroll en detalle de trámite
   ────────────────────────────────────────── */
.chat-scrollable {
    max-height: 400px;
    padding-right: 5px;
}

.timeline-scrollable {
    max-height: 220px;
    position: relative;
    padding-top: 5px;
    padding-bottom: 5px;
    overflow-x: hidden;
}

/* ──────────────────────────────────────────
   Chat — Adjuntos y archivos
   ────────────────────────────────────────── */
.chat-file-preview {
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-file-preview .bg-light {
    background-color: var(--color-background) !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(--color-primary) !important;
    color: var(--gray-900) !important;
    background-color: var(--color-surface) !important;
    font-weight: var(--font-weight-medium);
}

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

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

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

.message-error-text {
    font-size: 0.7rem;
    color: var(--danger);
    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: var(--info);
    animation: spin 1s ease-in-out infinite;
}

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

/* ──────────────────────────────────────────
   Secciones dinámicas V8
   ────────────────────────────────────────── */
.bg-light-warning {
    background-color: var(--warning-light);
}

/* ──────────────────────────────────────────
   Document Viewer Premium
   ────────────────────────────────────────── */
.modal-viewer-body {
    min-height: 500px;
    background-color: var(--color-background);
    background-image: radial-gradient(var(--gray-300) 0.5px, transparent 0.5px);
    background-size: 10px 10px;
}

/* ──────────────────────────────────────────
   Utilidades de offset y contenedores
   ────────────────────────────────────────── */
.floating-container-offset {
    margin-top: -3.5rem;
    position: relative;
    z-index: 10;
}

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

.submissions-offset-container {
    margin-top: -3rem;
}

/* ──────────────────────────────────────────
   Document Card Action Buttons Hover
   ────────────────────────────────────────── */
.documents-container .view-doc-btn:hover {
    background-color: var(--info-light) !important;
    border-color: var(--info) !important;
}

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

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

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

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

/* ──────────────────────────────────────────
   Submission Detail — Inline style replacements
   ────────────────────────────────────────── */
.doc-card-rounded {
    border-radius: var(--radius-lg);
    border-color: var(--gray-300) !important;
}

.doc-icon-box {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-title-sm {
    font-size: 0.9rem;
}

.doc-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.doc-action-icon {
    font-size: 0.8rem;
}

.doc-meta-xs {
    font-size: 0.65rem;
}

.chat-filename-truncate {
    max-width: 200px;
}

.chat-close-xs {
    font-size: 0.6rem;
}

.doc-viewer-modal {
    z-index: 1060;
}

.doc-viewer-icon {
    width: 32px;
    height: 32px;
}

.doc-viewer-icon-text {
    font-size: 0.9rem;
}

.doc-viewer-body {
    min-height: 480px;
}

/* ──────────────────────────────────────────
   Submission Engine — Inline style replacements
   ────────────────────────────────────────── */
.stepper-btn-hidden {
    opacity: 0;
}

.max-w-500 {
    max-width: 500px;
}

.field-observation-alert {
    font-size: var(--font-size-xs);
    border-left: 3px solid var(--danger) !important;
}

.file-current-alert {
    border-left: 3px solid var(--info);
    background-color: var(--info-light);
    border-color: var(--info);
}

.file-meta-border {
    border: 1px dashed var(--color-border);
}

.file-preview-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
}

/* ──────────────────────────────────────────
   Responsive
   ────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .chat-message-container {
        max-width: 95%;
    }

    .chat-scrollable {
        max-height: 350px;
    }

    .timeline {
        padding-left: 20px;
    }

    .timeline-marker {
        left: -20px;
        width: 14px;
        height: 14px;
    }

    .timeline-item.active .timeline-marker {
        width: 18px;
        height: 18px;
        left: -22px;
    }

    .floating-container-offset {
        margin-top: -2rem;
    }
}
