/* agenda.css — PoliMed src/css */
/* Stili: agenda, planner, sale, slot, modali principali, side-panel */

:root {
    --slot-height: 80px;
}

/* FIX: Pulsante conferma orario - visibilità forzata */
#btn-conferma-orario {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    pointer-events: auto !important;
    background-color: var(--accent) !important;
    color: white !important;
    border: none !important;
    cursor: pointer !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    font-weight: bold !important;
    margin-left: 2px !important;
    z-index: 9999 !important;
}

/* FIX: Forza la visibilità del pulsante Nuova Prenotazione - OVERRIDE MASSIMO */
body>.main-container>header>.header-actions>.btn-header-nuovo,
header .header-actions .btn-header-nuovo,
header button.btn-header-nuovo {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    left: auto !important;
    width: auto !important;
    height: 38px !important;
    pointer-events: auto !important;
    z-index: 1000 !important;
    background-color: var(--accent) !important;
    color: white !important;
}

.planner-area {
    flex: 1;
    min-height: 0;
    padding: 10px 20px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.planner-master {
    flex: 1;
    min-height: 0;
    background: white;
    border: 1px solid var(--border);
    overflow: auto;
    position: relative;
    display: grid;
    grid-template-columns: 80px repeat(var(--colonne-sale, 6), 1fr);
    grid-template-rows: auto 1fr;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    scroll-behavior: smooth;
    height: 100%;
    min-height: 400px;
    min-width: 900px;
}

.sale-header {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid;
    grid-template-columns: subgrid;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.15);
}

.header-cell {
    padding: 12px 15px;
    text-align: center;
    font-weight: bold;
    color: var(--text-main);
    text-transform: uppercase;
    font-size: 0.85em;
    border-right: 1px solid var(--border);
    background: #ffffff;
}

.delay-badge {
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.delay-pos {
    background: #ffebee;
    color: #c62828;
}

.delay-neg,
.delay-recupero {
    background: #e8f5e9;
    color: #2e7d32;
}

.delay-ok {
    background: #167D87;
    color: #ffffff;
}

.grid-body {
    grid-column: 1 / -1;
    grid-row: 2;
    position: relative;
    display: grid;
    grid-template-columns: subgrid;
    align-content: start;
}

.time-column {
    grid-column: 1;
    display: grid;
    grid-auto-rows: var(--slot-height);
    border-right: 1px solid var(--border);
    background: #ffffff;
    z-index: 50;
    position: sticky;
    left: 0;
}

.time-cell {
    box-sizing: border-box;
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-size: 0.75em;
    color: #7f8c8d;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.time-cell.half {
    color: #95a5a6;
    font-weight: 400;
    font-size: 0.7em;
}

.time-cell.quarter {
    color: #dcdde1;
    font-weight: 400;
    font-size: 0.65em;
}

.appointments-container {
    grid-column: 2 / -1;
    position: relative;
    display: grid;
    grid-template-columns: subgrid;
}

.appointments-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(to bottom, transparent calc(100% - 1px), var(--border) calc(100% - 1px));
    background-size: 100% var(--slot-height);
    pointer-events: none;
    z-index: 5;
}

.sala-column-v {
    border-right: 1px solid var(--border);
    position: relative;
    height: 100%;
    min-height: 1000px;
    cursor: default;
    background: #ffffff;
}

.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #e74c3c;
    z-index: 40;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(231, 76, 60, 0.5);
    display: none;
}

.current-time-line::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #e74c3c;
}

.appointment-card {
    position: absolute;
    left: 0;
    right: 0;
    color: var(--text-main);
    padding: 6px 30px 24px 10px;
    font-size: 0.82em;
    font-family: 'Inter', sans-serif;
    z-index: 10;
    overflow: hidden;
    border: none;
    border-left: 3px solid var(--room-color);
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    transition: filter 0.2s, box-shadow 0.2s;
    border-radius: 0;
    background-color: #ffffff !important;
    pointer-events: all;
    min-height: 28px;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.card-stato-icon {
    position: absolute !important;
    right: 2px;
    left: auto;
    bottom: 2px;
    top: auto;
    display: flex !important;
    flex-direction: row;
    gap: 3px;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    z-index: 11;
    padding: 2px 4px;
    background: transparent;
    border-radius: 4px;
    box-shadow: none;
}
.card-stato-icon svg {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.appointment-card:hover {
    filter: brightness(0.97);
    z-index: 100;
    outline: none;
    box-shadow: inset 0 0 0 1px var(--room-color), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.appointment-card.stato-1,
.appointment-card.stato-2,
.appointment-card.stato-3,
.appointment-card.stato-4,
.appointment-card.stato-5,
.appointment-card.stato-6,
.appointment-card.stato-7 {
    border-bottom: none !important;
}

.card-esame-effettuato {
    position: absolute !important;
    top: 2px;
    right: 2px;
    z-index: 12;
    opacity: 0.9;
    line-height: 0;
    display: flex;
    gap: 1px;
    align-items: center;
    padding: 2px 4px;
    background: transparent;
    border-radius: 4px;
    box-shadow: none;
}

.app-info {
    display: none !important;
}

.appointment-card.search-highlight {
    outline: 3px solid var(--accent) !important;
    box-shadow: 0 0 0 6px rgba(22, 125, 135, 0.18), 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    z-index: 200 !important;
    animation: searchPulse 0.6s ease 2;
}

@keyframes searchPulse {
    0% {
        box-shadow: 0 0 0 6px rgba(22, 125, 135, 0.18);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(22, 125, 135, 0.35);
    }

    100% {
        box-shadow: 0 0 0 6px rgba(22, 125, 135, 0.18);
    }
}

#search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    max-height: 360px;
    overflow-y: auto;
    display: none;
}

.appointment-card strong {
    font-size: 1em !important;
    font-weight: 700 !important;
    margin-bottom: 2px !important;
    white-space: normal !important;
    overflow: hidden !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    width: 100% !important;
    color: #111 !important;
    display: block !important;
    line-height: 1.25 !important;
}

.app-info {
    font-size: 0.88em;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    opacity: 0.82;
    margin-bottom: 1px;
    line-height: 1.3;
}

.card-row-prestazione {
    font-size: 0.88em;
    font-weight: 500;
    color: #333;
    opacity: 0.82;
    margin-top: 1px;
    white-space: normal;
    overflow: hidden;
    display: block;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.card-row-medico {
    font-size: 0.82em;
    font-weight: 600;
    color: #167D87;
    opacity: 0.95;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: block;
    line-height: 1.25;
    word-break: break-word;
}

.tiny-card {
    padding: 2px 30px 2px 10px !important;
    overflow: hidden !important;
    height: var(--slot-h, 40px) !important;
    z-index: 20;
}

.tiny-card strong {
    font-size: 0.88em !important;
    font-weight: 700 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0 !important;
    line-height: 1.2;
}

.tiny-card .card-row-extra,
.tiny-card .card-row-prestazione,
.tiny-card .card-row-medico {
    display: block !important;
    font-size: 0.78em !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.1;
    margin-top: 0 !important;
    opacity: 0.82;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    -webkit-box-orient: unset !important;
}

.tiny-card .card-stato-icon {
    bottom: 3px !important;
}

.tiny-card .card-stato-icon svg {
    width: 16px !important;
    height: 16px !important;
    flex: 0 0 16px !important;
}

.card-arrivo-icon {
    position: absolute !important;
    top: 2px;
    right: 2px;
    z-index: 12;
    opacity: 0.85;
    line-height: 0;
    padding: 2px 4px;
    background: transparent;
    border-radius: 4px;
    box-shadow: none;
}

.tiny-card .card-arrivo-icon {
    top: 2px;
    right: 3px;
}

.tiny-card .card-arrivo-icon svg {
    width: 9px !important;
    height: 9px !important;
}

.small-card .card-arrivo-icon svg {
    width: 10px !important;
    height: 10px !important;
}

.small-card {
    padding: 4px 30px 4px 10px !important;
    overflow: hidden !important;
    height: var(--slot-h, 64px) !important;
    z-index: 20;
}

.small-card strong {
    font-size: 0.94em !important;
    font-weight: 700 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px !important;
    line-height: 1.25;
}

.small-card .card-row-extra,
.small-card .card-row-prestazione,
.small-card .card-row-medico {
    font-size: 0.82em !important;
    white-space: normal !important;
    overflow: hidden !important;
    line-height: 1.2;
    margin-top: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

.small-card .card-stato-icon {
    bottom: 4px !important;
}

.small-card .card-stato-icon svg {
    width: 16px !important;
    height: 16px !important;
    flex: 0 0 16px !important;
}

.card-progress,
.card-progress-fill {
    display: none !important;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    border: 1px solid var(--accent);
    border-top: 4px solid var(--accent);
    border-radius: 8px;
    transition: border-top-color 0.3s ease;
}

.modal.show {
    display: block;
}

#modal-creazione {
    width: 400px;
}

#modal-creazione.show {
    display: flex !important;
}

#modal-sale {
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 0 10px;
    height: 38px;
    border: 1px solid #ddd;
    font-size: 0.95em;
    outline: none;
    border-radius: 6px;
    transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus {
    border-color: var(--accent);
}

.btn-salva {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0 15px;
    height: 38px;
    width: 100%;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s;
}

.btn-salva:hover {
    filter: brightness(1.1);
}

.btn-annulla {
    background: transparent;
    color: #7f8c8d;
    border: 1px solid transparent;
    padding: 0 15px;
    height: 38px;
    width: 100%;
    cursor: pointer;
    margin-top: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-annulla:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-footer .btn-salva,
.modal-footer .btn-annulla {
    width: auto;
    height: auto;
    padding: 5px 14px;
    font-size: 0.74em;
    margin-top: 0;
}

.sala-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.sala-row input {
    flex: 1;
    padding: 0 10px;
    height: 38px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.2s;
}

.sala-row input:focus {
    border-color: var(--accent);
}

.color-picker {
    display: flex;
    gap: 5px;
}

.color-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s;
}

.color-circle:hover {
    transform: scale(1.1);
}

.color-circle.active {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px white inset;
}

#side-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--panel-width);
    height: 100%;
    background: white;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

#side-panel.open {
    transform: translateX(0);
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.4em;
}

.btn-close {
    font-size: 24px;
    color: #95a5a6;
    cursor: pointer;
    line-height: 1;
}

.panel-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.data-box {
    border: 1px solid var(--border);
    padding: 15px;
    margin-bottom: 15px;
    background: #fafafa;
    border-radius: 6px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.btn-modifica {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0 12px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-modifica:hover {
    background: var(--accent);
    color: white;
}

.btn-action {
    padding: 0 15px;
    height: 38px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    font-size: 0.85em;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-accetta {
    background: #e74c3c;
    color: white;
    font-size: 0.78em;
    text-transform: uppercase;
}

.btn-accetta:hover {
    filter: brightness(1.1);
}

.ai-flow-container {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.btn-wf {
    flex: 1;
    padding: 0 5px;
    height: 38px;
    font-size: 0.75em;
    font-weight: bold;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-wf:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 900;
    display: none;
}

#overlay.show {
    display: block;
}

.modal-header {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--text-main);
    text-transform: uppercase;
    font-size: 0.85em;
}

/* --- STILI ISOLATI PER IL MODULO ACCETTAZIONE/ANAGRAFICA --- */
#modal-paziente {
    width: 900px;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    border-top: none;
}

#modal-paziente.show {
    display: flex;
    flex-direction: column;
}

#modal-paziente .modal-header {
    padding: 20px;
    background: #fff;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    text-transform: none;
}

.modal-tabs {
    display: flex;
    background: #f8f9fa;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 15px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: #7f8c8d;
    border-bottom: 3px solid transparent;
    font-size: 0.9em;
    transition: 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    background: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-title {
    font-size: 0.85em;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-main);
    margin: 25px 0 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.form-group.full {
    grid-column: 1 / -1;
}

/* Layout con Prestazione più larga (2fr) e Medico/Sala più piccoli (1fr ciascuno) */
.form-grid-prestazione {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
}

.input-wrapper {
    width: 100%;
    position: relative;
}

/* --- DESIGN CAMPI OBBLIGATORI (VERDE POLIMED SOFFUSO) --- */
.mandatory-input {
    background-color: rgba(22, 125, 135, 0.04) !important;
    border: 1px solid rgba(22, 125, 135, 0.2) !important;
}

.mandatory-input:focus {
    background-color: #ffffff !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(22, 125, 135, 0.1) !important;
}

.asterisk {
    color: var(--danger);
    margin-left: 3px;
}

.search-anagrafica-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    margin-bottom: 25px;
    position: relative;
}

.search-anagrafica-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    outline: none;
    transition: 0.2s;
}

.search-anagrafica-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--accent);
    z-index: 9999;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.search-item {
    padding: 14px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    transition: background 0.1s;
}

.search-item:hover {
    background: #f0f4f8;
}

.modal-footer {
    padding: 15px 25px;
    background: transparent;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-close {
    font-size: 24px;
    color: #95a5a6;
    cursor: pointer;
    line-height: 1;
}

/* --- OVERRIDE ESTETICO (RICHIESTO) --- */
.modal {
    position: relative;
}

/* Serve per sganciare la X */
.modal-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    color: var(--text-main);
    font-weight: 900;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    color: #bdc3c7;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #e74c3c;
}

/* Etichette più forti e visibili */
.form-group label {
    font-size: 0.8em !important;
    font-weight: 800 !important;
    color: #2c3e50 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Override specifico per il footer del modal accettazione paziente */
#modal-paziente .modal-footer {
    background: #fff !important;
    border-top: 1px solid var(--border) !important;
    padding: 16px 35px !important;
    flex-shrink: 0 !important;
    align-items: center !important;
}

/* Override specifico per il footer del modal prenotazione */
#modal-creazione .modal-footer {
    background: white !important;
    border-top: 1px solid #e0e0e0 !important;
    padding: 10px 24px 14px !important;
    flex-shrink: 0 !important;
    margin-top: 0 !important;
}

/* --- FIX CENTRATURA E DESIGN MODALE --- */
.modal {
    display: none;
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    /* Forza la centratura matematica */
    background: white;
    padding: 30px;
    z-index: 3000;
    /* Assicura che stia sopra il planner */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.modal.show {
    display: flex !important;
    flex-direction: column;
}

/* Rende le etichette dei box molto leggibili */
.form-group label {
    font-weight: 800 !important;
    color: #2c3e50 !important;
    text-transform: uppercase;
    font-size: 0.75rem !important;
    margin-bottom: 5px;
    display: block;
}

/* Stile per i pulsanti in basso (liberi da rettangoli) — già definito sopra */
/* --- DESIGN CALENDARIO PREMIUM --- */
.flatpickr-calendar {
    font-family: inherit;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
}

/* Mese Verde Polimed e in Grassetto */
.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: var(--accent) !important;
    font-weight: 900 !important;
    text-transform: uppercase;
}

/* Quadratino Verde Sfumato al passaggio del mouse */
.flatpickr-day:hover {
    background: rgba(22, 125, 135, 0.1) !important;
    border-radius: 8px !important;
    border-color: transparent !important;
    color: var(--accent) !important;
    font-weight: bold;
}

/* Quadratino Verde Polimed Pieno quando selezionato */
.flatpickr-day.selected {
    background: var(--accent) !important;
    border-radius: 8px !important;
    border-color: var(--accent) !important;
    color: white !important;
    font-weight: bold;
}

/* --- FORZATURA DATA PRENOTAZIONE (GABBIA VERDE POLIMED) --- */
.data-verde-forzata input {
    font-weight: 900 !important;
    color: var(--accent) !important;
    text-align: center !important;
    letter-spacing: 1px !important;
    background-color: #ffffff !important;
    /* Ripristina le dimensioni perfette ignorando Flatpickr */
    width: 100% !important;
    height: 38px !important;
    padding: 0 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    outline: none !important;
}

.data-verde-forzata input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(22, 125, 135, 0.1) !important;
}

.panel-header {
    position: relative;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.patient-info-box {
    position: relative;
    flex: 1;
    padding-bottom: 15px;
}

.action-icons-container {
    position: absolute;
    bottom: -5px;
    right: 0;
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-icon-minimal {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s, color 0.2s;
}

.btn-icon-minimal:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.btn-icon-minimal svg {
    width: 18px;
    height: 18px;
}

.btn-cestino-pannello {
    color: #95a5a6;
}

.btn-cestino-pannello:hover {
    color: #e74c3c !important;
    opacity: 1;
}
@keyframes highlight-pulse-anim {
    0% { transform: scale(1); box-shadow: 0 4px 15px rgba(22, 125, 135, 0.4); border-right: 2px solid transparent; }
    50% { transform: scale(1.02); box-shadow: 0 4px 20px rgba(22, 125, 135, 0.8); border-right: 3px solid #167D87; z-index: 200; }
    100% { transform: scale(1); box-shadow: 0 4px 15px rgba(22, 125, 135, 0.4); border-right: 2px solid transparent; }
}
.appointment-card.highlight-pulse {
    animation: highlight-pulse-anim 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    z-index: 100 !important;
}

/* Badge ritardo e ora arrivo su card griglia */
.card-arrivo-txt {
    font-size: 0.72em;
    color: #167D87;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-ritardi-bar {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-top: 2px;
    margin-bottom: 2px;
}
.card-ritardo-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68em;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1.2;
}
.card-ritardo-badge.puntual {
    background: rgba(46, 204, 113, 0.12);
    color: #27ae60;
}
.card-ritardo-badge.ritardo-paziente {
    background: rgba(231, 76, 60, 0.10);
    color: #e74c3c;
}
.card-ritardo-badge.ritardo-centro {
    background: rgba(243, 156, 18, 0.10);
    color: #f39c12;
}
.tiny-card .card-arrivo-txt,
.tiny-card .card-ritardi-bar {
    display: none !important;
}
