/* =========================================
   Activity Calendar Dual-Mode Visual Styles
   Distinzione chiara: Appuntamenti vs Task
   ========================================= */

/* =====================
   APPUNTAMENTI (RequiresAppointment = true)
   Bordo solido, colori vivaci, enfasi visiva
   ===================== */
.e-schedule .e-appointment[data-requires-appointment="true"] {
    border-left: 4px solid !important;
    font-weight: 500;
    opacity: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* =====================
   TASK (RequiresAppointment = false)
   Bordo tratteggiato, opacità ridotta, stile discreto
   ===================== */
.e-schedule .e-appointment[data-requires-appointment="false"] {
    border-left: 4px dashed !important;
    opacity: 0.85;
    font-style: italic;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
}

/* =====================
   COMPLETATE - Strikethrough e opacità ridotta
   ===================== */
.e-schedule .e-appointment[data-status="Completed"] {
    opacity: 0.6 !important;
    text-decoration: line-through;
}

.e-schedule .e-appointment[data-status="Completed"] .e-subject {
    text-decoration: line-through;
}

/* =====================
   OVERDUE - Task scaduti in rosso acceso
   ===================== */
.e-schedule .e-appointment[data-is-overdue="true"] {
    background-color: #dc3545 !important;
    color: white !important;
    border-left-color: #b02a37 !important;
    animation: pulse-overdue 2s ease-in-out infinite;
}

.e-schedule .e-appointment[data-is-overdue="true"] .e-subject {
    color: white !important;
    font-weight: 600 !important;
}

@keyframes pulse-overdue {
    0%, 100% {
        opacity: 0.85;
    }
    50% {
        opacity: 1;
    }
}

/* =====================
   BADGE TIPO ATTIVITÀ
   ===================== */
.activity-type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 4px;
    white-space: nowrap;
    vertical-align: middle;
}

.activity-type-badge.appointment {
    background-color: #0d6efd;
    color: white;
}

.activity-type-badge.task {
    background-color: #198754;
    color: white;
}

.activity-type-badge.overdue {
    background-color: #dc3545;
    color: white;
}

/* =====================
   ICONE APPUNTAMENTO/TASK
   ===================== */
.activity-icon {
    display: inline-block;
    margin-right: 4px;
    font-size: 0.9rem;
}

.activity-icon.appointment::before {
    content: "📅";
}

.activity-icon.task::before {
    content: "✓";
}

.activity-icon.overdue::before {
    content: "⚠️";
}

/* =====================
   LEGENDA VISIVA
   ===================== */
.calendar-legend {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.calendar-legend h6 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.legend-icon {
    display: inline-block;
    width: 30px;
    height: 20px;
    border-radius: 3px;
}

.legend-icon.solid {
    border-left: 4px solid #0d6efd;
    background: rgba(13, 110, 253, 0.1);
}

.legend-icon.dashed {
    border-left: 4px dashed #198754;
    background: rgba(25, 135, 84, 0.1);
}

.legend-icon.overdue {
    border-left: 4px solid #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.legend-icon.completed {
    border-left: 4px solid #6c757d;
    background: rgba(108, 117, 125, 0.1);
    opacity: 0.6;
}

/* =====================
   FILTRI CALENDARIO
   ===================== */
.calendar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-filters .btn-group {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.calendar-filters .btn {
    border-radius: 0;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.calendar-filters .btn-check:checked + .btn-outline-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
    font-weight: 600;
}

.calendar-filters .btn-check:checked + .btn-outline-success {
    background-color: #198754;
    border-color: #198754;
    color: white;
    font-weight: 600;
}

.calendar-filters .btn-check:checked + .btn-outline-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    font-weight: 600;
}

/* =====================
   TOOLTIP PERSONALIZZATI
   ===================== */
.activity-tooltip {
    min-width: 250px;
    max-width: 400px;
}

.activity-tooltip .tooltip-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.activity-tooltip .tooltip-body {
    font-size: 0.875rem;
}

.activity-tooltip .tooltip-body h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.activity-tooltip .tooltip-body > div {
    margin-bottom: 0.25rem;
    color: #6c757d;
}

/* =====================
   EVENTO CALENDARIO - Contenuto custom
   ===================== */
.e-schedule .e-appointment .activity-content {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.e-schedule .e-appointment .activity-subject {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =====================
   VISTA AGENDA - Styling specifico
   ===================== */
.e-schedule .e-agenda-view .activity-agenda-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.e-schedule .e-agenda-view .activity-agenda-icon {
    font-size: 1.2rem;
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 768px) {
    .calendar-legend {
        padding: 0.75rem;
    }

    .legend-items {
        gap: 0.5rem;
    }

    .legend-item {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .calendar-filters .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    .activity-type-badge {
        font-size: 0.65rem;
        padding: 1px 4px;
    }
}

/* =====================
   ACCESSIBILITY - High Contrast Mode
   ===================== */
@media (prefers-contrast: high) {
    .e-schedule .e-appointment[data-requires-appointment="true"] {
        border-left-width: 6px !important;
    }

    .e-schedule .e-appointment[data-requires-appointment="false"] {
        border-left-width: 6px !important;
    }

    .activity-type-badge {
        border: 2px solid currentColor;
    }
}

/* =====================
   PRINT STYLES
   ===================== */
@media print {
    .calendar-filters,
    .legend-item {
        page-break-inside: avoid;
    }

    .e-schedule .e-appointment[data-requires-appointment="false"] {
        background-image: none;
        border-left-style: solid !important;
    }

    .activity-type-badge {
        border: 1px solid currentColor;
    }
}
