/* ================================================================
   MODAL PRENOTAZIONE CALENDARIO
   ================================================================ */

#pcal-pop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99997;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pcal-popover {
    background: #fff;
    border-radius: 12px;
    width: 380px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
}

#pcal-popover-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 18px 14px;
    color: #fff;
}

#pcal-pop-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

#pcal-pop-dates {
    font-size: 12px;
    opacity: .85;
    margin-top: 3px;
}

#pcal-pop-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    opacity: .7;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 10px;
}
#pcal-pop-close:hover { opacity: 1; }

#pcal-popover-body {
    padding: 14px 18px;
    font-size: 13px;
    line-height: 2;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

#pcal-popover-foot {
    display: flex;
    gap: 6px;
    padding: 12px 18px;
    justify-content: flex-end;
}

/* ── Back bar contestuale ─────────────────────────────────────── */
.sgd-back-bar {
    margin-bottom: 14px;
}

/* ================================================================
   MODAL NUOVA PRENOTAZIONE
   ================================================================ */

#pcal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#pcal-modal {
    background: #fff;
    border-radius: 14px;
    width: 520px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.28);
}

#pcal-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px 14px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
}
#pcal-modal-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}
#pcal-modal-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,.75);
    margin-top: 3px;
}
#pcal-modal-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: .9;
    flex-shrink: 0;
    margin-left: 12px;
}
#pcal-modal-close:hover { background: rgba(255,255,255,.3); opacity: 1; }

#pcal-modal-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Label sopra — layout verticale */
.pcal-modal-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.pcal-modal-row label {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.pcal-modal-row input,
.pcal-modal-row select,
.pcal-modal-row textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #1e2024;
    background: #f9fafb;
    box-sizing: border-box;
    transition: border-color .15s, background .15s;
}
.pcal-modal-row input:focus,
.pcal-modal-row select:focus {
    border-color: #2563eb;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.pcal-modal-row textarea { resize: vertical; min-height: 70px; }

#pcal-modal-foot {
    display: flex;
    gap: 8px;
    padding: 14px 22px 18px;
    border-top: 1px solid #f3f4f6;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── Misc ─────────────────────────────────────────────────────── */
.sc-pagination { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.sc-pag-info { font-size: 12px; color: #6b7280; margin-right: 6px; }

.sc-unit-chip {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #dbeafe;
    color: #1e40af;
}
.pb-unit-unassigned { background: #fef3c7; color: #92400e; }
/* ── Lista prenotazioni (sr-*) ────────────────────────────────── */
.sr-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.sr-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    transition: background .12s;
    cursor: default;
}
.sr-row:last-child { border-bottom: none; }
.sr-row:hover { background: #fafafa; }

.sr-row-left { flex: 1; min-width: 0; }

.sr-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.sr-row-bot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sr-ref {
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    background: #f0fdf4;
    color: #166534;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #bbf7d0;
}
.sr-ref--wc {
    background: #faf5ff;
    color: #6d28d9;
    border-color: #e9d5ff;
}

.sr-guest {
    font-size: 14px;
    font-weight: 700;
    color: #2563eb;
    cursor: pointer;
    text-decoration: none;
}
.sr-guest:hover { text-decoration: underline; }

.sr-lav {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 7px;
    border-radius: 20px;
}
.sr-lav--checkin  { background: #dbeafe; color: #1d4ed8; }
.sr-lav--presente { background: #d1fae5; color: #065f46; }
.sr-lav--checkout { background: #fef3c7; color: #92400e; }
.sr-lav--chiusa   { background: #f3f4f6; color: #374151; }

.sr-product { font-size: 13px; font-weight: 600; color: #374151; }
.sr-unit    { font-size: 11px; background: #ecfdf5; color: #166534; padding: 1px 6px; border-radius: 20px; border: 1px solid #a7f3d0; }
.sr-dates   { font-size: 12px; color: #6b7280; }
.sr-nights  { font-size: 12px; color: #9ca3af; }

.sr-row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    min-width: 110px;
}
.sr-total { font-size: 15px; font-weight: 800; color: #1e2024; }
.sr-cap   { font-size: 11px; color: #6b7280; }
.sr-bal   { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.sr-bal--ok     { background: #f0fdf4; color: #166534; }
.sr-bal--due    { background: #fef2f2; color: #dc2626; }
.sr-bal--refund { background: #fff7ed; color: #9a3412; }

.sr-actions { display: flex; gap: 4px; margin-top: 4px; }

/* ── Ospiti checkin (sr-cg-*) ─────────────────────────────────── */
.sr-cg-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    flex-wrap: wrap;
}
.sr-cg-row:last-child { border-bottom: none; }
.sr-cg-name {
    font-weight: 600;
    font-size: 13px;
    color: #2563eb;
    cursor: pointer;
    flex: 1;
}
.sr-cg-name:hover { text-decoration: underline; }
.sr-cg-time { font-size: 12px; color: #6b7280; }

/* ── Quick form modal — layout ────────────────────────────────── */
.pcal-modal-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.pcal-modal-three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Sezione con separatore visivo */
.pcal-modal-section {
    padding-top: 4px;
}
.pcal-modal-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f3f4f6;
}

/* Autocomplete ospite */
#pcal-guest-search-wrap { position: relative; }
#pcal-guest-search {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fafb;
    box-sizing: border-box;
}
#pcal-guest-search:focus {
    border-color: #2563eb;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

#pcal-guest-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    z-index: 9999;
    max-height: 220px;
    overflow-y: auto;
}
.pcal-gr-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
    transition: background .1s;
}
.pcal-gr-item:last-child { border-bottom: none; }
.pcal-gr-item:hover { background: #eff6ff; }
.pcal-gr-item strong { color: #1e2024; }
.pcal-gr-item span { font-size: 11px; color: #9ca3af; margin-left: 6px; }
.pcal-gr-new { color: #2563eb; font-weight: 600; font-style: italic; }

#pcal-guest-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
}
#pcal-guest-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #93c5fd;
    font-size: 16px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
#pcal-guest-clear:hover { color: #dc2626; }

/* Form ospite — visibile di default */
#pcal-new-guest-form {
    margin-top: 10px;
}
.pcal-ng-or {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pcal-ng-or::before,
.pcal-ng-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* Prezzo calcolato */
#pcal-modal-price-wrap {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1.5px solid #86efac;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.pcal-price-total {
    font-size: 22px;
    font-weight: 800;
    color: #15803d;
    letter-spacing: -.01em;
}
.pcal-price-nights {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}
.pcal-price-discount {
    font-size: 12px;
    color: #dc2626;
    font-weight: 600;
    background: #fef2f2;
    padding: 2px 8px;
    border-radius: 20px;
}
.pcal-price-cap {
    font-size: 12px;
    color: #1d4ed8;
    font-weight: 600;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 20px;
}

/* Bottone WCM */
.sc-btn-wcm {
    background: #2563eb;
    color: #fff;
    border-color: #1d4ed8;
}
.sc-btn-wcm:hover { background: #1d4ed8; }

/* Modal WCM */
#pcal-wcm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
#pcal-wcm-modal {
    background: #fff;
    border-radius: 14px;
    width: 480px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
}
#pcal-wcm-head {
    background: #2563eb;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.pcal-wcm-title { font-size: 16px; font-weight: 700; }
.pcal-wcm-subtitle { font-size: 12px; opacity: .8; margin-top: 2px; }
#pcal-wcm-head button {
    background: none; border: none; color: #fff;
    font-size: 20px; cursor: pointer; opacity: .7; padding: 0;
}
#pcal-wcm-head button:hover { opacity: 1; }
#pcal-wcm-body { padding: 20px; }
#pcal-wcm-foot {
    padding: 12px 20px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
}