/* ============================================================
   SISTEMA TRACKING VISIVO STILE AMAZON - TMC TICKETS
   File: ticket-tracking-v2.css
   Versione: 2.0 - MIGLIORATA ESTETICA
   ============================================================ */

/* Container principale timeline */
.ticket-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    position: relative;
    width: 100%;
}

/* Singolo step della timeline */
.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

/* Dot/cerchio dello stato */
.timeline-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #ffffff;
    border: 3px solid #e0e0e0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    position: relative;
}

/* Stato completato - VERDE BRILLANTE */
.timeline-step.completed .timeline-dot {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
    color: white;
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
    transform: scale(1.05);
}

/* Stato attivo (in corso) - BLU ANIMATO */
.timeline-step.active .timeline-dot {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    border-color: #2196F3;
    color: white;
    animation: pulse-smooth 2s ease-in-out infinite;
    box-shadow: 0 0 0 6px rgba(33, 150, 243, 0.15);
    transform: scale(1.1);
    font-weight: bold;
}

/* Stato pendente (da fare) - GRIGIO CHIARO */
.timeline-step.pending .timeline-dot {
    background: #fafafa;
    border-color: #e0e0e0;
    color: #bdbdbd;
}

/* Animazione pulsazione più smooth */
@keyframes pulse-smooth {
    0%, 100% {
        box-shadow: 0 0 0 6px rgba(33, 150, 243, 0.15);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(33, 150, 243, 0.08);
    }
}

/* Label sotto il dot */
.timeline-label {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #333;
    max-width: 80px;
    line-height: 1.2;
}

.timeline-step.completed .timeline-label {
    color: #4CAF50;
    font-weight: 700;
}

.timeline-step.active .timeline-label {
    color: #2196F3;
    font-weight: 700;
}

.timeline-step.pending .timeline-label {
    color: #999;
    font-weight: 500;
}

/* Data e ora */
.timeline-date {
    font-size: 10px;
    color: #666;
    margin-top: 3px;
    text-align: center;
    white-space: nowrap;
}

.timeline-step.completed .timeline-date {
    color: #4CAF50;
}

.timeline-step.active .timeline-date {
    color: #2196F3;
}

/* Nome utente */
.timeline-user {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
    text-align: center;
    font-style: italic;
    white-space: nowrap;
}

/* Linea di connessione tra gli step - PIÙ SPESSA */
.timeline-line {
    flex: 1;
    height: 4px;
    background: #e0e0e0;
    position: relative;
    margin: 0 -8px;
    z-index: 1;
    border-radius: 2px;
    transition: all 0.4s ease;
}

.timeline-line.completed {
    background: linear-gradient(90deg, #4CAF50 0%, #66BB6A 100%);
    box-shadow: 0 1px 3px rgba(76, 175, 80, 0.3);
}

/* ============================================================
   VERSIONE COMPATTA (per lista ticket)
   ============================================================ */

.ticket-timeline.compact {
    padding: 12px 0;
    justify-content: center;
    gap: 8px;
}

.ticket-timeline.compact .timeline-step {
    flex: 0 0 auto;
}

.ticket-timeline.compact .timeline-dot {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-width: 3px;
}

.ticket-timeline.compact .timeline-step.completed .timeline-dot {
    transform: scale(1);
}

.ticket-timeline.compact .timeline-step.active .timeline-dot {
    transform: scale(1.05);
}

/* MOSTRA le etichette anche nella versione compatta */
.ticket-timeline.compact .timeline-label {
    display: block;
    font-size: 9px;
    margin-top: 4px;
    max-width: 70px;
}

/* MOSTRA date e utenti nella versione compatta */
.ticket-timeline.compact .timeline-date {
    display: block;
    font-size: 8px;
    margin-top: 2px;
}

.ticket-timeline.compact .timeline-user {
    display: block;
    font-size: 8px;
    margin-top: 1px;
}

.ticket-timeline.compact .timeline-line {
    flex: 0 0 24px;
    width: 24px;
    height: 3px;
    margin: 0;
}

/* ============================================================
   VERSIONE COMPLETA (per dettaglio ticket)
   ============================================================ */

.ticket-timeline.full {
    padding: 30px 20px;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        transparent 18px,
        #f8f9fa 18px, 
        #f8f9fa 100%
    );
    border-radius: 12px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.ticket-timeline.full .timeline-step {
    flex: 1;
}

.ticket-timeline.full .timeline-dot {
    width: 44px;
    height: 44px;
    font-size: 20px;
}

.ticket-timeline.full .timeline-line {
    margin: 0 -12px;
}

/* Warning per ticket scaduti */
.timeline-warning {
    margin-top: 15px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffe5a0 100%);
    border-left: 4px solid #ff9800;
    border-radius: 6px;
    font-size: 13px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.1);
    font-weight: 500;
}

/* ============================================================
   EFFETTI HOVER
   ============================================================ */

.timeline-step:hover .timeline-dot {
    transform: scale(1.1);
    cursor: help;
}

.timeline-step.completed:hover .timeline-dot {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.timeline-step.active:hover .timeline-dot {
    box-shadow: 0 0 0 8px rgba(33, 150, 243, 0.2);
}

.timeline-step.pending:hover .timeline-dot {
    border-color: #bdbdbd;
    background: #f5f5f5;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .ticket-timeline.full {
        padding: 20px 10px;
    }
    
    .ticket-timeline.full .timeline-dot {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .timeline-label {
        font-size: 10px;
        max-width: 60px;
    }
    
    .timeline-date,
    .timeline-user {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    /* OTTIMIZZAZIONE MOBILE - Timeline compatta più piccola */
    .ticket-timeline.compact {
        padding: 8px 0;
        gap: 4px;
        transform: scale(0.9);
        transform-origin: center center;
    }
    
    .ticket-timeline.compact .timeline-dot {
        width: 24px;
        height: 24px;
        font-size: 12px;
        border-width: 2px;
    }
    
    .ticket-timeline.compact .timeline-label {
        font-size: 7px;
        margin-top: 3px;
        max-width: 50px;
    }
    
    .ticket-timeline.compact .timeline-date {
        font-size: 6px;
        margin-top: 1px;
    }
    
    .ticket-timeline.compact .timeline-user {
        font-size: 6px;
        margin-top: 1px;
    }
    
    .ticket-timeline.compact .timeline-line {
        width: 12px;
        height: 2px;
    }
    
    /* Timeline full - dettaglio ticket - PIÙ COMPATTA */
    .ticket-timeline.full {
        padding: 10px 0;
        gap: 2px;
        transform: scale(0.85);
        transform-origin: center center;
    }
    
    .ticket-timeline.full .timeline-dot {
        width: 22px;
        height: 22px;
        font-size: 10px;
        border-width: 2px;
    }
    
    .ticket-timeline.full .timeline-label {
        font-size: 7px;
        max-width: 45px;
        margin-top: 2px;
        line-height: 1.1;
    }
    
    .ticket-timeline.full .timeline-date {
        font-size: 6px;
        margin-top: 1px;
    }
    
    .ticket-timeline.full .timeline-user {
        font-size: 6px;
        margin-top: 1px;
        display: none; /* Nascondi utente su mobile per risparmiare spazio */
    }
    
    .ticket-timeline.full .timeline-line {
        width: 8px;
        height: 2px;
        margin: 0;
    }
    
    /* Nascondi stati pendenti lontani in versione full mobile */
    .ticket-timeline.full .timeline-step.pending:not(:first-child) .timeline-label {
        display: none;
    }
}

/* ============================================================
   INTEGRAZIONE CON STILE ESISTENTE
   ============================================================ */

/* Sostituisce la vecchia barra percentuale */
.ticket-card .ticket-progress {
    padding: 8px 0;
    background: transparent;
    border: none;
    margin-top: 10px;
}

/* Nel dettaglio ticket */
.ticket-detail-table .timeline-container {
    padding: 15px 0;
}

/* Miglioramento visibilità nella card */
.ticket-card {
    position: relative;
}

.ticket-card .ticket-timeline.compact {
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    margin-top: 12px;
}

/* ============================================================
   TOOLTIP (opzionale - per mostrare info al hover)
   ============================================================ */

.timeline-step {
    position: relative;
}

.timeline-step::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.timeline-step:hover::before {
    opacity: 1;
}

/* ============================================================
   STAMPA (per PDF)
   ============================================================ */

@media print {
    .ticket-timeline {
        page-break-inside: avoid;
    }
    
    .timeline-step.active .timeline-dot {
        animation: none;
    }
    
    .timeline-warning {
        border: 1px solid #ff9800;
    }
}
