/* ================================================================
   CALENDARIO
   ================================================================ */

#piero-cal-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

/* ── Toolbar calendario ───────────────────────────────────────── */
#piero-cal-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-wrap: wrap;
}

#piero-cal-stats {
    display: flex;
    gap: 10px;
    flex: 1;
}

.pcal-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    min-width: 90px;
    background: #fff;
}
.pcal-stat-checkin  { border-color: #a78bfa; }
.pcal-stat-checkout { border-color: #f87171; }
.pcal-stat-presenti { border-color: #34d399; }

.pcal-stat-num {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    color: #1e2024;
}
.pcal-stat-label {
    font-size: 11px;
    color: #6b7280;
    margin-top: 3px;
    text-align: center;
}
.pcal-stat-checkin .pcal-stat-label  { color: #7c3aed; }
.pcal-stat-checkout .pcal-stat-label { color: #dc2626; }
.pcal-stat-presenti .pcal-stat-label { color: #059669; }

/* ── Viste ────────────────────────────────────────────────────── */
#piero-cal-views {
    display: flex;
    background: #e5e7eb;
    border-radius: 7px;
    padding: 2px;
    gap: 2px;
}

.pcal-view-btn {
    padding: 5px 14px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    background: none;
    color: #6b7280;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.pcal-view-btn.active {
    background: #fff;
    color: #1e2024;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* ── Navigazione ──────────────────────────────────────────────── */
#piero-cal-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
#piero-cal-nav button {
    height: 32px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 16px;
    color: #374151;
    cursor: pointer;
    transition: background .15s;
}
#piero-cal-nav button:hover { background: #f3f4f6; }
#pcal-today { font-size: 13px; font-weight: 600; }

/* ── Label periodo ────────────────────────────────────────────── */
#piero-cal-period-label {
    padding: 10px 20px 6px;
    font-size: 17px;
    font-weight: 700;
    color: #2563eb;
}

/* ── Contenitore griglia ──────────────────────────────────────── */
#piero-cal-container {
    overflow-x: auto;
    position: relative;
}

#piero-cal-loading {
    padding: 40px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

#piero-cal-grid {
    position: relative;
    min-width: 700px;
}

/* ── Tabella griglia ──────────────────────────────────────────── */
#pcal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/* Colonna unità */
#pcal-table .pcal-col-unit {
    width: 160px;
    min-width: 140px;
    padding: 8px 12px;
    border-right: 2px solid #e5e7eb;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    background: #f9fafb;
}

#pcal-table thead .pcal-col-unit {
    background: #f3f4f6;
    border-bottom: 2px solid #d1d5db;
}

.pcal-unit-type {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    line-height: 1.3;
}
.pcal-unit-code {
    display: block;
    font-size: 11px;
    color: #2563eb;
    font-weight: 600;
    margin-top: 1px;
}

/* Colonne giorno */
#pcal-table th.pcal-col-day {
    padding: 6px 2px 4px;
    text-align: center;
    border-bottom: 2px solid #d1d5db;
    border-right: 1px solid #e5e7eb;
    background: #4a6741;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    min-width: 80px;
}

#pcal-table th.pcal-col-day.pcal-today {
    background: #2563eb;
}

.pcal-dow {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: .85;
}
.pcal-dn {
    display: block;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
}

.pcal-sub-cols {
    display: flex;
    justify-content: space-around;
    font-size: 9px;
    font-weight: 500;
    opacity: .7;
    margin-top: 3px;
    letter-spacing: .05em;
}

/* Celle corpo */
#pcal-table td.pcal-cell {
    height: 52px;
    padding: 2px;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #e5e7eb;
    vertical-align: top;
    cursor: pointer;
    transition: background .1s;
    position: relative;
}
#pcal-table td.pcal-cell:hover {
    background: #eff6ff;
}

/* Righe alternate */
#pcal-table tbody tr:nth-child(even) .pcal-cell { background: #fafafa; }
#pcal-table tbody tr:nth-child(even) .pcal-cell:hover { background: #eff6ff; }

/* ── Celle con blocco prenotazione (colspan) ──────────────────── */
#pcal-table td.pcal-cell-block {
    padding: 3px 2px;
    cursor: default;
    vertical-align: middle;
}

/* ── Blocco prenotazione colspan ──────────────────────────────── */
.pcal-block-colspan {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    transition: box-shadow .15s, filter .1s;
}
.pcal-block-colspan:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
    filter: brightness(.93);
}

/* ── Blocco inline vista giorno ───────────────────────────────── */
.pcal-block-inline {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    overflow: hidden;
    white-space: nowrap;
    transition: box-shadow .15s, filter .1s;
}
.pcal-block-inline:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.22);
    filter: brightness(.93);
}

.pcal-block-label {
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pcal-block-amount {
    font-size: 12px;
    font-weight: 600;
    opacity: .9;
    flex-shrink: 0;
}
.pcal-block-dates {
    font-size: 11px;
    font-weight: 400;
    opacity: .75;
    flex-shrink: 0;
}

/* Colori blocchi */
.pcal-b-green  { background: #4a7a42; color: #fff; }
.pcal-b-blue   { background: #2563eb; color: #fff; }
.pcal-b-yellow { background: #f59e0b; color: #fff; }
.pcal-b-amber  { background: #d97706; color: #fff; }
.pcal-b-grey   { background: #6b7280; color: #fff; }
.pcal-b-red    { background: #dc2626; color: #fff; }

/* ── Linea oggi ───────────────────────────────────────────────── */
#pcal-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #2563eb;
    z-index: 5;
    pointer-events: none;
}
#pcal-today-line-label {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 9px;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: .05em;
    white-space: nowrap;
    background: rgba(255,255,255,.9);
    padding: 1px 3px;
    border-radius: 2px;
}

