/* static/css/new-timeline.css */

/* Controles de filtro */
.timeline-filter-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eef2f7;
}

.filter-btn {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e0;
}

.filter-btn.active {
    background-color: #4f46e5; /* Un azul más moderno */
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.2);
}

/* Diseño de Tarjeta de Timeline REFINADO */
.timeline-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background-color: #ffffff;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
}

.timeline-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
}

/* Icono a la izquierda */
.timeline-card-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

/* Contenido principal (título y fecha) */
.timeline-card-content {
    flex-grow: 1;
    min-width: 0; /* Permite que el elipsis funcione dentro de flex */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
}

.timeline-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-card-date {
    font-size: 13px;
    color: #8b99ad;
}

/* Días transcurridos a la derecha (REFINADO) */
.timeline-card-days {
    flex: 0 0 82px;
    text-align: right;
    margin-left: 4px;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.days-ago-number {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
}

.days-ago-text {
    font-size: 10px;
    color: #94a3b8;
    text-transform: none;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.days-ago-prefix {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    line-height: 1;
}

.days-ago-value {
    font-size: 22px;
    font-weight: 800;
    color: #0ea5e9; /* Azul vivo parecido a la referencia */
    line-height: 1;
}

/* Botón de eliminar en la tarjeta */
.timeline-delete-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 8px;
}

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

.timeline-delete-btn:active {
    transform: scale(0.95);
}

.timeline-delete-btn i {
    font-size: 14px;
}

/* Estilos para el estado vacío, por si se muestra */
.empty-timeline {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-timeline i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================
   ESTILOS PARA COMENTARIOS EN TIMELINE
   ============================================ */

/* Tarjeta con comentario - estructura de dos filas */
.timeline-card.has-comment {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.timeline-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

/* Meta info (fecha y estado) */
.timeline-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.timeline-card-meta .timeline-card-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-card-meta .timeline-card-date i {
    font-size: 11px;
    opacity: 0.7;
}

.timeline-card-status {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sección de comentarios */
.timeline-card-comment {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    width: 100%;
}

.timeline-card-comment .comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: #667eea;
    font-size: 12px;
    font-weight: 600;
}

.timeline-card-comment .comment-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-card-comment .comment-header i {
    font-size: 14px;
}

.timeline-card-comment .comment-text {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
    border-left: 3px solid #667eea;
    position: relative;
}

.timeline-card-comment .comment-toggle {
    background: transparent;
    border: none;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 4px;
}

.timeline-card-comment .comment-toggle:hover {
    text-decoration: underline;
}

.timeline-card-comment.is-collapsed .comment-text {
    max-height: 88px;
    overflow: hidden;
}

.timeline-card-comment.is-collapsed .comment-text::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 24px;
    background: linear-gradient(180deg, rgba(248, 249, 255, 0) 0%, rgba(248, 249, 255, 1) 100%);
}

.timeline-card-comment .comment-text::before {
    content: '\201C';
    position: absolute;
    top: -5px;
    left: 8px;
    font-size: 28px;
    color: #667eea;
    opacity: 0.3;
    font-family: Georgia, serif;
}

/* Botón de descarga individual por evento */
.timeline-download-btn {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    margin-left: 8px;
}

.timeline-download-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.timeline-download-btn:active {
    transform: scale(0.95);
}

.timeline-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* En tracking publico: mostrar comentarios solo al hacer click */
#client-timeline .timeline-card-comment.is-collapsed {
    display: none;
}

/* Responsive para comentarios */
@media (max-width: 480px) {
    .timeline-card-header {
        flex-wrap: wrap;
    }

    .timeline-card-days {
        width: 100%;
        flex: none;
        margin-top: 10px;
        text-align: left;
        align-items: flex-start;
        flex-direction: row;
        gap: 8px;
    }

    .days-ago-value {
        font-size: 18px;
    }

    .timeline-card-comment .comment-text {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* ============================================
   TRACKING PROFILE CARD - Vista publica
   ============================================ */

.tracking-profile {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    overflow: hidden;
    margin-bottom: 24px;
    animation: tpSlideIn 0.5s ease-out;
}

@keyframes tpSlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.tp-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 32px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
}

.tp-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
}

.tp-photo-wrapper {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.tp-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background: #e2e8f0;
}

.tp-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 2;
}

.tp-name {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 800;
    color: white;
    line-height: 1.2;
    word-break: break-word;
}

.tp-position {
    margin: 0 0 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tp-position i {
    font-size: 12px;
    opacity: 0.8;
}

.tp-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tp-status .badge {
    font-size: 13px;
    padding: 5px 14px;
    font-weight: 700;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.tp-folio {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 12px;
}

.tp-folio i {
    font-size: 11px;
}

/* Detalles: Fecha registro, ultima actualizacion */
.tp-details {
    display: flex;
    gap: 16px;
    padding: 12px 32px 20px;
    flex-wrap: wrap;
}

.tp-detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    flex: 1;
    min-width: 160px;
}

.tp-detail-item > i {
    color: #667eea;
    font-size: 16px;
    flex-shrink: 0;
}

.tp-detail-label {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tp-detail-value {
    display: block;
    font-size: 14px;
    color: #1e293b;
    font-weight: 700;
}

/* Proxima entrevista */
.tp-interview {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 32px 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 14px;
    border: 1px solid #fbbf24;
}

.tp-interview-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tp-interview-icon i {
    color: #d97706;
    font-size: 18px;
}

.tp-interview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp-interview-label {
    font-size: 11px;
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tp-interview-date {
    font-size: 15px;
    font-weight: 800;
    color: #78350f;
}

.tp-interview-type {
    font-size: 12px;
    color: #a16207;
    font-weight: 600;
}

/* Timeline header con filtros integrados */
.tp-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.tp-timeline-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-timeline-header h3 i {
    color: #667eea;
}

.tp-timeline-header .timeline-filter-controls {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Botones de accion */
.tp-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.tp-actions .download-docs-btn,
.tp-actions .new-query-btn {
    flex: 1;
    min-width: 160px;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.tp-actions .download-docs-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.tp-actions .download-docs-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.tp-actions .new-query-btn {
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.tp-actions .new-query-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

/* Responsive */
@media (max-width: 600px) {
    .tp-header {
        flex-direction: column;
        text-align: center;
        padding: 28px 20px 16px;
        gap: 16px;
    }

    .tp-photo {
        width: 80px;
        height: 80px;
    }

    .tp-name {
        font-size: 20px;
    }

    .tp-status {
        justify-content: center;
    }

    .tp-details {
        padding: 12px 20px 16px;
        flex-direction: column;
        gap: 10px;
    }

    .tp-detail-item {
        min-width: unset;
    }

    .tp-interview {
        margin: 0 20px 20px;
    }

    .tp-timeline-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tp-actions {
        flex-direction: column;
    }

    .tp-actions .download-docs-btn,
    .tp-actions .new-query-btn {
        min-width: unset;
    }
}

/* Dark mode — tracking profile público */
.dark-mode .tracking-profile {
    background: var(--light-color);
    border-color: var(--border-color);
}

.dark-mode .tp-header::after {
    background: var(--light-color);
}

/* Folio: texto blanco explícito en ambos modos (el header siempre es gradiente morado).
   color-scheme: light evita que el browser fuerce su propio modo oscuro sobre el gradiente */
.tp-header {
    color-scheme: light;
}

.tp-folio {
    color: rgba(255, 255, 255, 0.9) !important;
    background: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Timeline cards en dark mode */
.dark-mode .timeline-card {
    background-color: var(--card-background);
    border-color: var(--border-color);
    color: var(--text-color);
}

.dark-mode .timeline-card-title {
    color: var(--text-color);
}

.dark-mode .timeline-card-date {
    color: var(--text-secondary);
}

/* Filtros de timeline en dark mode */
.dark-mode .filter-btn {
    background-color: var(--input-background);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.dark-mode .filter-btn:hover {
    background-color: var(--input-hover-background);
    border-color: var(--border-color);
}

/* Detalles del perfil */
.dark-mode .tp-detail-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

.dark-mode .tp-detail-label {
    color: var(--text-secondary);
}

.dark-mode .tp-detail-value {
    color: var(--text-color);
}

/* Próxima entrevista en dark mode */
.dark-mode .tp-interview {
    background: linear-gradient(135deg, rgba(120, 60, 0, 0.35) 0%, rgba(160, 100, 0, 0.35) 100%);
    border-color: rgba(251, 191, 36, 0.35);
}

.dark-mode .tp-interview-label {
    color: #fcd34d;
}

.dark-mode .tp-interview-date {
    color: #fde68a;
}

.dark-mode .tp-interview-type {
    color: #fbbf24;
}

.dark-mode .tp-timeline-header h3 {
    color: var(--text-color);
}

.dark-mode .tp-actions .new-query-btn {
    background: var(--light-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* Separador de timeline en dark mode */
.dark-mode .timeline-filter-controls {
    border-bottom-color: var(--border-color);
}

/* Modal de tracking con tamaño adaptativo */
.modal-tracking {
    max-width: 420px;
    transition: max-width 0.3s ease;
}

.modal-tracking:has(#modal-results[style*="display: block"]),
.modal-tracking-expanded {
    max-width: 600px;
}

/* ============================================
   PUBLIC TRACKING TIMELINE OVERRIDES
   ============================================ */
#client-timeline-container {
    padding: 0;
}

#client-timeline {
    position: static;
    padding: 0;
}

#client-timeline::before {
    display: none !important;
}

#client-timeline.timeline {
    border-left: none !important;
}

#client-timeline .timeline-card {
    margin-left: 0;
}
