/* ===================================
   TIMELINE VIEW - v3.8.0
   Vista giornaliera con griglia oraria
   =================================== */

/* Timeline Container */
.timeline-view-container {
    display: none;
    background: var(--bg-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timeline-view-container.active {
    display: block;
}

/* Timeline Header */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.timeline-date-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.timeline-date-display {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    min-width: 200px;
    text-align: center;
}

.timeline-nav-btn {
    padding: 8px 12px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.timeline-nav-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.timeline-actions {
    display: flex;
    gap: 8px;
}

.timeline-view-btn {
    padding: 8px 16px;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.timeline-view-btn:hover {
    background: var(--secondary-bg);
}

.timeline-view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Timeline Grid */
.timeline-grid-container {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 600px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--secondary-bg);
}

.timeline-grid {
    position: relative;
    display: grid;
    grid-template-columns: 80px 1fr;
    min-height: 100%;
}

/* Hours Column */
.timeline-hours {
    border-right: 2px solid var(--border-color);
    background: var(--tertiary-bg);
}

.timeline-hour {
    height: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.timeline-hour:last-child {
    border-bottom: none;
}

/* Events Column */
.timeline-events {
    position: relative;
}

.timeline-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
}

.timeline-hour-line:hover {
    background: rgba(74, 158, 255, 0.05);
    cursor: pointer;
}

/* Current Time Indicator */
.timeline-current-time {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--error-color);
    z-index: 10;
    pointer-events: none;
}

.timeline-current-time::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -5px;
    width: 12px;
    height: 12px;
    background: var(--error-color);
    border-radius: 50%;
}

/* Timeline Event */
.timeline-event {
    position: absolute;
    left: 8px;
    right: 8px;
    padding: 8px;
    border-radius: 6px;
    border-left: 4px solid;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timeline-event:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 15;
}

.timeline-event.dragging {
    opacity: 0.5;
    cursor: move;
}

/* Event Content */
.timeline-event-time {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.9;
    margin-bottom: 2px;
}

.timeline-event-title {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-event-tag {
    font-size: 10px;
    opacity: 0.8;
    margin-top: 4px;
}

/* Priority Colors */
.timeline-event[data-priority="alta"] {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-left-color: #991b1b;
}

.timeline-event[data-priority="media"] {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-left-color: #92400e;
}

.timeline-event[data-priority="bassa"] {
    background: linear-gradient(135deg, #10b981, #059669);
    border-left-color: #065f46;
}

/* TODO Events - Special Styling */
.timeline-event.is-todo {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-left: 4px solid #6d28d9;
    border-style: dashed;
    opacity: 0.9;
}

.timeline-event.is-todo:hover {
    opacity: 1;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.timeline-event.is-todo .timeline-event-time::before {
    content: '✓ ';
}

/* Event Resize Handle */
.timeline-event-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.timeline-event:hover .timeline-event-resize-handle {
    opacity: 1;
}

.timeline-event-resize-handle::after {
    content: '⋯';
    font-size: 16px;
    color: white;
}

/* Empty State */
.timeline-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

.timeline-empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.timeline-empty-state-text {
    font-size: 16px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .timeline-grid {
        grid-template-columns: 60px 1fr;
    }
    
    .timeline-hour {
        font-size: 11px;
        height: 50px;
    }
    
    .timeline-hour-line {
        height: 50px;
    }
    
    .timeline-event-title {
        font-size: 12px;
    }
    
    .timeline-date-display {
        font-size: 16px;
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .timeline-view-container {
        padding: 12px;
    }
    
    .timeline-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .timeline-date-nav {
        width: 100%;
        justify-content: center;
    }
    
    .timeline-actions {
        width: 100%;
        justify-content: center;
    }
}
