﻿/* =========================================================
   FILE: agenda-shared.css
   Condiviso tra: Agenda Network + Riepilogo Attività
   ========================================================= */

main, .container, .container-fluid, .content, .content-wrapper, .app-content {
    max-width: 100% !important;
    width: 100% !important;
}

/* Card / layout base */
#mainCard.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0,0,0,.05);
    padding: 14px;
    width: 100%;
    position: relative;
}

#mainCard .title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

#mainCard .title {
    font-size: 24px; /* ✅ leggermente più piccolo (prima 26) */
    font-weight: 800;
    margin: 0;
}

#mainCard .subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}

#mainCard .small-muted {
    color: #6b7280;
    font-size: 12px;
}

#mainCard .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

    #mainCard .controls label {
        color: #374151;
        font-size: 13px;
        margin-right: 6px;
        white-space: nowrap;
    }

/* Scheduler full width */
#schedulerWrap .dx-scheduler,
#schedulerWrap .dx-scheduler-work-space {
    width: 100% !important;
}

/* ======================================================
   Overlay
   ====================================================== */
#schedulerWrap.scheduler-wrap {
    position: relative;
}

#schedOverlay.panel-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(2px);
    z-index: 40;
    border-radius: 14px;
}

    #schedOverlay.panel-overlay .txt {
        font-size: 13px;
        color: #111827;
        font-weight: 900;
    }

/* ======================================================
   ZOOM (variabili su #schedulerWrap)
   ====================================================== */
#schedulerWrap {
    --schedZoom: 1;
    --schedCellBase: 34px;
    --schedCellH: calc(var(--schedCellBase) * var(--schedZoom));
    --ydeaStripeW: 7px;
}

    #schedulerWrap .dx-scheduler-date-table-cell,
    #schedulerWrap .dx-scheduler-time-panel-cell {
        height: var(--schedCellH) !important;
    }

    #schedulerWrap .dx-scheduler-date-table-row,
    #schedulerWrap .dx-scheduler-time-panel-row {
        height: var(--schedCellH) !important;
    }

    #schedulerWrap .dx-scheduler-all-day-table-cell {
        min-height: calc(28px * var(--schedZoom)) !important;
    }

    #schedulerWrap .dx-scheduler-appointment-content {
        font-size: calc(13px * var(--schedZoom)) !important;
        line-height: calc(16px * var(--schedZoom)) !important;
        padding: 6px 8px !important; /* ✅ più respiro sopra */
        overflow: hidden;
        box-sizing: border-box;
    }

/* ======================================================
   FIX: “troppo attaccato in alto”
   - il box parte all’ora giusta (non tocchiamo TOP),
     ma diamo più padding interno e togliamo top=0 nei compact
   ====================================================== */
#scheduler .dx-scheduler-appointment-content {
    padding-top: 6px !important;
}

    #scheduler .dx-scheduler-appointment-content.appt-compact {
        padding-top: 4px !important; /* ✅ prima era 3 e in alcuni casi 0 */
        padding-bottom: 4px !important;
    }

/* ======================================================
   YDEA (DB/TEMP) + stripe OE/NS + background per tipo
   ====================================================== */

/* base comune YDEA */
#scheduler .src-db,
#scheduler .src-temp {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
    /* padding con spazio stripe a sinistra */
    padding: 6px 8px 6px calc(8px + var(--ydeaStripeW)) !important;
}

    /* stripe OE */
    #scheduler .src-db.az-oe::before,
    #scheduler .src-temp.az-oe::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--ydeaStripeW);
        background: #f59e0b;
    }
    /* stripe NS */
    #scheduler .src-db.az-ns::before,
    #scheduler .src-temp.az-ns::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--ydeaStripeW);
        background: #38bdf8;
    }

/* DB/TEMP bordi */
#scheduler .src-db {
    border: 2px solid #5b21b6 !important;
}

#scheduler .src-temp {
    border: 2px dashed #0b4a45 !important;
}

/* default (se NON ho bg-*) */
#scheduler .src-db:not(.bg-contratto):not(.bg-consuntivo):not(.bg-commessa):not(.bg-attivita-interna):not(.bg-arancio) {
    background: #7c3aed !important;
    color: #fff !important;
}

#scheduler .src-temp:not(.bg-contratto):not(.bg-consuntivo):not(.bg-commessa):not(.bg-attivita-interna):not(.bg-arancio) {
    background: #0f766e !important;
    color: #fff !important;
}

/* testi YDEA */
#scheduler .db-ticket {
    font-size: calc(14px * var(--schedZoom)) !important;
    line-height: calc(17px * var(--schedZoom)) !important;
    font-weight: 900;
    letter-spacing: .2px;
    margin: 1px 0 2px 0; /* ✅ piccolo distacco dall’alto */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#scheduler .db-sub {
    font-size: calc(12px * var(--schedZoom)) !important;
    line-height: calc(15px * var(--schedZoom)) !important;
    font-weight: 600;
    opacity: .95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#scheduler .db-contract {
    font-size: 12px;
    font-weight: 800;
    opacity: .92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* ======================================================
   Eventi brevi (appt-compact)
   ====================================================== */
#scheduler .appt-compact {
    display: flex !important;
    align-items: center !important;
    overflow: hidden !important;
}

    /* stripe più sottile nei compact */
    #scheduler .appt-compact.src-db.az-oe::before,
    #scheduler .appt-compact.src-db.az-ns::before,
    #scheduler .appt-compact.src-temp.az-oe::before,
    #scheduler .appt-compact.src-temp.az-ns::before {
        width: 5px !important;
    }

    /* nascondo righe secondarie nei compact */
    #scheduler .appt-compact .db-sub,
    #scheduler .appt-compact .appt-desc,
    #scheduler .appt-compact .appt-meta {
        display: none !important;
    }

/* ======================================================
   Spinner “singolo evento”
   ====================================================== */
#scheduler .appt-loader {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,.55);
    border-top-color: rgba(255,255,255,1);
    animation: apptSpin .8s linear infinite;
    pointer-events: none;
}

    #scheduler .appt-loader.dark {
        border: 2px solid rgba(17,24,39,.25);
        border-top-color: rgba(17,24,39,.85);
    }

@keyframes apptSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ======================================================
   Background per tipo (solo sfondo, non stripe)
   ====================================================== */
.bg-contratto {
    background-color: #d1fae5 !important;
}

.bg-consuntivo {
    background-color: #fee2e2 !important;
}

.bg-commessa {
    background-color: #fef9c3 !important;
}

.bg-attivita-interna {
    background-color: #dbeafe !important;
}

.bg-arancio {
    background-color: #ffedd5 !important;
}

/* testo scuro sui bg chiari */
#scheduler .src-db.bg-contratto,
#scheduler .src-db.bg-consuntivo,
#scheduler .src-db.bg-commessa,
#scheduler .src-db.bg-attivita-interna,
#scheduler .src-db.bg-arancio,
#scheduler .src-temp.bg-contratto,
#scheduler .src-temp.bg-consuntivo,
#scheduler .src-temp.bg-commessa,
#scheduler .src-temp.bg-attivita-interna,
#scheduler .src-temp.bg-arancio {
    color: #111827 !important;
}

    #scheduler .src-db.bg-contratto .db-ticket,
    #scheduler .src-db.bg-consuntivo .db-ticket,
    #scheduler .src-db.bg-commessa .db-ticket,
    #scheduler .src-db.bg-attivita-interna .db-ticket,
    #scheduler .src-db.bg-arancio .db-ticket,
    #scheduler .src-temp.bg-contratto .db-ticket,
    #scheduler .src-temp.bg-consuntivo .db-ticket,
    #scheduler .src-temp.bg-commessa .db-ticket,
    #scheduler .src-temp.bg-attivita-interna .db-ticket,
    #scheduler .src-temp.bg-arancio .db-ticket,
    #scheduler .src-db.bg-contratto .db-sub,
    #scheduler .src-db.bg-consuntivo .db-sub,
    #scheduler .src-db.bg-commessa .db-sub,
    #scheduler .src-db.bg-attivita-interna .db-sub,
    #scheduler .src-db.bg-arancio .db-sub,
    #scheduler .src-temp.bg-contratto .db-sub,
    #scheduler .src-temp.bg-consuntivo .db-sub,
    #scheduler .src-temp.bg-commessa .db-sub,
    #scheduler .src-temp.bg-attivita-interna .db-sub,
    #scheduler .src-temp.bg-arancio .db-sub {
        color: inherit !important;
    }

/* ======================================================
   Icone YDEA
   ====================================================== */
#scheduler .has-ydea-icons {
    padding-bottom: 28px !important; /* ✅ spazio icone */
}

#scheduler .ydea-icons {
    position: absolute;
    bottom: 4px;
    right: 6px;
    display: inline-flex;
    gap: 4px;
    align-items: center;
    z-index: 5;
    pointer-events: none;
}

#scheduler .ydea-ico {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,.75);
    border: 1px solid rgba(17,24,39,.18);
    box-sizing: border-box;
}

    #scheduler .ydea-ico svg {
        width: 14px;
        height: 14px;
        display: block;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.8;
    }

#scheduler .ydea-ico-adb {
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

#scheduler .ydea-ico.is-off {
    opacity: .45;
}

#scheduler .ydea-ico-cal31 {
    position: relative;
}

    #scheduler .ydea-ico-cal31 .num {
        position: absolute;
        bottom: 1px;
        right: 2px;
        font-size: 9px;
        font-weight: 900;
        line-height: 1;
    }

/* se ho riga contratto, alzo le icone */
#scheduler .has-contract-row .ydea-icons {
    bottom: 22px;
}

#scheduler .has-ydea-icons.has-contract-row {
    padding-bottom: 46px !important;
}



/* snippet note: di default nascosto */
.dx-scheduler-appointment .ydea-note {
    display: none;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.25;
    opacity: .92;
    overflow: hidden;
}

/* lo mostro solo se JS ha messo appt-roomy */
.dx-scheduler-appointment.appt-roomy .ydea-note {
    display: block;
    max-height: 54px; /* regola tu */
}

/* clamp a 3 righe */
.dx-scheduler-appointment .ydea-note-snippet {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 1) Lo scheduler sta sotto alle popup DevExpress (che sono in overlay su <body>) */
#scheduler {
    position: relative;
    z-index: 1; /* basso: le dxPopup resteranno sopra */
}

    /* 2) Selezione Outlook: evidenzia sopra gli altri appuntamenti, ma NON sopra le popup */
    #scheduler .dx-scheduler-appointment.appt-selected-outlook {
        z-index: 50 !important; /* abbastanza per stare sopra gli altri eventi */
        overflow: visible !important;
        border-radius: 10px !important;
        box-shadow: 0 0 0 3px #111827, 0 0 0 6px #ffffff, 0 10px 22px rgba(0,0,0,.25) !important;
    }

        /* opzionale: un filo più “cicciotto” senza cambiare colore */
        #scheduler .dx-scheduler-appointment.appt-selected-outlook .dx-scheduler-appointment-content {
            padding-top: 2px !important;
            padding-bottom: 2px !important;
        }



/* DevExtreme scheduler aria text (25.x) - must be visually hidden */
.dx-scheduler-aria-label,
.dx-scheduler-aria-description,
.dx-screen-reader-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
