body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    padding: 10px;
    margin: 0;
}

h1, h2 {
    color: #222;
    margin-left: 5px;
}

#calendar table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#calendar th {
    padding: 8px;
    background: #0078D7;
    color: white;
    font-size: 14px;
}

#calendar td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    background: white;
    font-size: 16px;
}

#calendar td:hover {
    background: #e8f3ff;
}

.has-event div {
    background: #ffffff00; /* trasparente */
    border: 2px solid transparent;
}

.selected-day {
    outline: 3px solid #000 !important;   /* bordo nero spesso */
    outline-offset: -2px;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.4);
    filter: brightness(1.05);
}

.event-item {
    padding: 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    border-left: 4px solid #0078D7;
    font-size: 16px;
}

.event-item:hover {
    background: #eef6ff;
}

.family-item {
    background: #fff;
    padding: 10px;
    margin: 6px 0;
    border-radius: 6px;
    border-left: 4px solid #444;
    font-size: 15px;
}

#calendar-container {
    max-width: 500px;
    margin: 0 auto 20px auto;
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.calendar-header select {
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
}

#manual-refresh,
#create-event-btn {
    background: #0078D7;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px 4px;
    font-size: 15px;
}

#manual-refresh:hover,
#create-event-btn:hover {
    background: #005bb5;
}

#event-actions button {
    background: #444;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    margin-right: 6px;
    margin-top: 10px;
    cursor: pointer;
    font-size: 14px;
}

#event-actions button:hover {
    background: #222;
}

.update-bar {
    display: none;
    width: 100%;
    background: #00c853;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
}

.update-bar.show {
    display: block;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;

  align-items: center;
  justify-content: center;

  padding: 16px;
  box-sizing: border-box;
}

.modal-content {
  background: #fff;
  width: 95%;
  max-width: 480px;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: pop-in 0.25s ease;
  box-sizing: border-box;
}

.modal-content h2 {
  margin-top: 0;
  text-align: center;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 18px;
  border-radius: 8px;
  border: 1px solid #bbb;
  font-size: 15px;
  box-sizing: border-box;
}

.modal-buttons {
       display: flex;
       justify-content: center;    /* <-- centrati */
       gap: 12px;                  /* spazio uniforme */
       margin-top: 4px;
}

.modal-buttons .cancel {
       background: #bbb;
       color: #fff;
       padding: 10px 20px;
       border-radius: 8px;
       border: none;
       cursor: pointer;
}

.modal-buttons .confirm {
       background: #0078D7;
       color: #fff;
       padding: 10px 20px;
       border-radius: 8px;
       border: none;
       cursor: pointer;
}

.modal-buttons button:hover {
       opacity: 0.85;
}

#event-modal select#event-type {
    padding: 14px 12px;      /* aumenta altezza */
    font-size: 17px;         /* testo più grande e leggibile */
    border-radius: 10px;     /* più elegante */
    border: 1px solid #aaa;
    width: 100%;             /* occupa tutta la larghezza */
    box-sizing: border-box;
    margin-bottom: 20px;     /* più spazio sotto */
}

@keyframes pop-in {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

textarea {
    resize: none;
    height: 70px;
}

.total-box {
    background: #f0f8ff;
    padding: 10px;
    border-radius: 8px;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

@media (max-width: 600px) {
       .family-grid { grid-template-columns: 1fr; }
       body { padding: 5px; }
       h1 { font-size: 24px; }
       h2 { font-size: 20px; }

       #calendar th {
           font-size: 12px;
           padding: 5px;
       }

       #calendar td {
           font-size: 14px;
           padding: 8px;
       }

       .event-item { font-size: 15px; }
       .family-item { font-size: 14px; }
       .modal-content {
           border-radius: 22px;
           padding: 26px;
       }
}

.riposo-day {
    background: #c2f5c2 !important;
    border: 2px solid #29a329 !important;
}

.day-riposo {
    background: #c8f7c5 !important;    /* verde chiaro */
    border: 2px solid #2e7d32 !important;
}

.day-work {
    background: #ffe0b2 !important;    /* arancione chiaro */
    border: 2px solid #ef6c00 !important;
}

#dip-header {
    background:#004D40 !important;
    color:white !important;
    padding:18px;
    text-align:center;
    border-radius:0 0 14px 14px;
    box-shadow:0 2px 4px rgba(0,0,0,0.25);
    margin-bottom:15px;
}

#turno-tipo {
    margin-bottom: 14px !important;
}

#ora-inizio {
    margin-bottom: 14px !important;
}

#ora-fine {
    margin-bottom: 14px !important;
}

#turno-modal .modal-content label {
    display: block;
    margin-top: 12px;
}

#turno-modal .modal-content label:nth-of-type(2) {
    margin-top: 22px;
}

.turno-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.turno-row label {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

.turno-row select {
    transform: translateY(12px);
    padding: 8px;
    font-size: 15px;
    max-width: 180px;
}

.family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.family-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.family-name {
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
}

.family-people,
.family-phone,
.family-notes,
.family-total {
    font-size: 14px;
    margin-bottom: 3px;
}

.family-total strong {
    font-size: 15px;
}

.btn-action {
    background: #1565C0;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-action:hover {
    opacity: 0.85;
}

.btn-add {
    background: #2e7d32 !important;
}

.family-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.family-actions button {
    flex: 1 1 0;
    padding: 8px 0;
    font-size: 14px;
    text-align: center;
    border-radius: 6px;
    border: none;
    box-sizing: border-box;
}

.family-actions .btn-action {
    background: #1565C0;       /* blu */
}

.family-actions .btn-delete {
    background: #d9534f;       /* rosso */
}

#event-details > .btn-action,
#event-details > .btn-add,
#event-details > .btn-delete {
    display: inline-block;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    margin-right: 6px;
    margin-bottom: 8px;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    #event-details > .btn-delete {
        background-color: #d9534f !important;
        margin-top: 16px !important;
        margin-bottom: 8px !important;
    }

    .family-grid {
        grid-template-columns: 1fr;
    }
}

#content-container h1 {
    text-align: center;
    margin-top: 35px;
    margin-bottom: 15px;
}

.top-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.top-buttons button {
    font-size: 15px;
}

#calendar-container {
    margin-top: 25px;
}

@media (max-width: 600px) {
    #content-container h1 {
        margin-top: 25px;
        font-size: 22px;
    }

    .top-buttons {
        flex-direction: column;
        align-items: center;
    }

    .top-buttons button {
        width: 90%;
    }
}

#event-modal .modal-buttons {
    margin-top: 28px !important;
}

#dip-header #dip-legend {
    display: none !important;
}

#family-modal .modal-buttons button {
    flex: 1 1 0 !important;
    padding: 12px 0 !important;
    font-size: 16px !important;
    text-align: center;
    box-sizing: border-box;
}

.event-item.past {
    opacity: 0.55;
    background: #eeeeee !important;
    border-left-color: #888 !important;
    text-decoration: line-through;
}

.future-event-day {
    background: #c8f7c5 !important;
    border: 2px solid #2e7d32 !important;
    font-weight: bold;
    position: relative;
}

.past-event-day {
    background: #ffe0b2 !important;
    border: 2px solid #ef6c00 !important;
    font-weight: bold;
    opacity: 0.9;
    text-decoration: line-through;
    position: relative;
}

.past-event-day::after {
    content: "✓";
    position: absolute;
    right: 4px;
    top: 2px;
    font-size: 14px;
    color: #2e7d32;
}

.discount-info {
    font-size: 12px;
    color: #d9534f;
    font-weight: bold;
}

.discount-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 500;
}

.discount-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 6px 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.discount-wrapper input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    accent-color: #1565C0 !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
}

.discount-wrapper span {
    font-weight: 600 !important;
    font-size: 15px !important;
    line-height: 18px !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
}

.discount-wrapper input[type="checkbox"],
.discount-wrapper span {
    transform: translateY(0px) !important;
}

.row-compact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.row-compact .field {
  flex: 1;
}

.row-compact .field input {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  box-sizing: border-box;
}

/* Contenitore pulsanti nel popup EVENTO */
#event-modal .modal-buttons {
    display: flex !important;
    justify-content: space-between !important;
    gap: 12px !important;
    margin-top: 22px !important;  /* distanza dai campi sopra */
}

/* Pulsanti con stessa grandezza */
#event-modal .modal-buttons .cancel,
#event-modal .modal-buttons .confirm {
    flex: 1 1 0 !important;        /* stessa larghezza */
    padding: 10px 0 !important;    /* stessa altezza */
    font-size: 15px !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    text-align: center !important;
}

/* Colori */
#event-modal .modal-buttons .cancel {
    background: #bbb !important;
    color: white !important;
}

#event-modal .modal-buttons .confirm {
    background: #0078D7 !important;
    color: white !important;
}

/* Riga sconto + pagamento */
.discount-pay-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 8px 0 4px;
}

/* Checkbox + testo sconto */
.discount-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.discount-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1565C0;
    margin: 0;
}

.discount-inline span {
    font-weight: 600;
    font-size: 15px;
    line-height: 18px;
}

/* Box pagamento */
.payment-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 1;
}

.payment-box label {
    font-size: 13px;
    margin-bottom: 2px;
}

.payment-box select {
    width: 100%;
    max-width: 170px;
    padding: 6px 8px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #bbb;
    box-sizing: border-box;
}

/* Riga acconto */
.acconto-row {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.acconto-row label {
    font-size: 14px;
}

.acconto-row input {
    padding: 8px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #bbb;
    box-sizing: border-box;
}

/* Info pagamento + acconto nella card cliente */
.family-payment {
    font-size: 13px;
    margin-bottom: 3px;
}

.family-acconto {
    font-size: 13px;
    margin-top: 2px;
    color: #2e7d32; /* verde */
}

.family-badges {
    margin: 6px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 6px;
    color: white;
}

.badge-sconto { background: #1565C0; }
.badge-acconto { background: #2e7d32; }
.badge-pay { background: #6a1b9a; }

/* LOGIN CARD MODERNA */
.login-card {
    max-width: 340px;
    margin: 70px auto;
    background: #fff;
    padding: 30px 24px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    animation: loginFade 0.35s ease-out;
}

/* Titolo */
.login-title {
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: bold;
    color: #1565C0;
}

/* Input wrapper */
.input-wrapper {
    display: flex;
    align-items: center;
    background: #f1f1f1;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    position: relative;
}

/* Icona sinistra */
.input-icon {
    margin-right: 10px;
    font-size: 18px;
}

/* Input */
.login-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
}

/* 👁️ toggle password */
.toggle-pass {
    cursor: pointer;
    opacity: 0.65;
}
.toggle-pass:hover {
    opacity: 1;
}

/* Checkbox riga */
.remember-row {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}

/* Bottone */
.login-btn {
    background: #1565C0;
    color: white;
    border: none;
    padding: 12px;
    font-size: 16px;
    width: 100%;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.25s;
}
.login-btn:hover {
    background: #0d47a1;
}

/* Errore */
.login-error {
    color: red;
    margin-top: 12px;
    font-size: 14px;
}

/* Animazione */
@keyframes loginFade {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
    width: 80px;
    height: auto;
    display: block;
    margin: 0 auto 12px auto;
    opacity: 0.95;
    animation: fadeInLogo 0.4s ease;
}

@keyframes fadeInLogo {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* Toolbar moderna e compatta */
.event-toolbar {
    display: flex;
    justify-content: space-between;
    background: #ffffff;
    padding: 8px 10px;
    border-radius: 10px;
    margin-top: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.event-toolbar .tl-item {
    flex: 1;
    border: none;
    background: none;
    color: #1565C0;
    font-size: 15px;
    padding: 6px 0;
    text-align: center;
    cursor: pointer;
}

.event-toolbar .tl-item span {
    display: block;
    font-size: 11px;
    margin-top: 2px;
}

.event-toolbar .tl-item.danger {
    color: #d9534f;
}

/* Scheda evento moderna */
.event-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

.event-card h3 {
    margin: 0;
    font-size: 21px;
    color: #222;
}

.ev-sub {
    margin: 6px 0 0 0;
    font-size: 14px;
    line-height: 19px;
    color: #444;
}

/* Animazione */
#event-details {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.event-toolbar {
    display: flex;
    justify-content: space-between;
    background: #ffffff;
    padding: 8px 10px;
    border-radius: 10px;
    margin-top: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.tl-item {
    flex: 1;
    border: none;
    background: none;
    color: #1565C0;
    font-size: 15px;
    cursor: pointer;
    text-align: center;
}

.tl-item span {
    display: block;
    font-size: 11px;
    margin-top: 2px;
}

.tl-item.danger {
    color: #d9534f;
}

.event-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

.event-card h3 {
    margin-top: 0;
    font-size: 21px;
}

/* TOOLBAR MODERNA */
.event-toolbar-modern {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

/* BOTTONE MODERNO */
.et-btn {
    flex: 1;
    padding: 12px 10px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

/* Effetto click */
.et-btn:active {
    transform: scale(0.97);
    opacity: 0.85;
}

/* COLORI DEI BOTTONI */
.et-btn.add {
    background: #2e7d32;
}

.et-btn.edit {
    background: #1565C0;
}

.et-btn.delete {
    background: #d9534f;
}

.et-btn.print {
    background: #6a1b9a;
}

.et-btn.pdf {
    background: #00838f;
}

@media (max-width: 600px) {
    .et-btn {
        font-size: 17px;
        padding: 14px;
    }
}

/* ====================
   FIX POPUP SCROLLING
   ==================== */

   /* === OVERLAY MODERNO (SFONDO SFUOCATO) === */
.modal {
       position: fixed;
       top: 0;
       left: 0;
       width: 100%;
       height: 100%;
       display: none;                     /* appare con JS */
       align-items: center;
       justify-content: center;
       backdrop-filter: blur(8px);        /* 🔥 sfondo sfocato moderno */
       background: rgba(0, 0, 0, 0.25);    /* leggera oscurità */
       z-index: 9999;
       animation: fadeIn 0.25s ease;
}

   /* === ANIMAZIONE ENTRATA === */
@keyframes fadeIn {
       from { opacity: 0; }
       to   { opacity: 1; }
}

@keyframes zoomIn {
       from {
           opacity: 0;
           transform: scale(0.85);
       }
       to {
           opacity: 1;
           transform: scale(1);
       }
}

.modal-content {
       background: #ffffff;
       width: 95%;
       max-width: 480px;
       height: auto;
       max-height: 90vh;
       padding: 16px 20px;        /* 🔥 ridotto spazio interno */
       border-radius: 10px;
       box-shadow: 0 8px 32px rgba(0,0,0,0.25);

       overflow-y: auto;
       scrollbar-gutter: stable both-edges;
       animation: zoomIn 0.25s ease;
}

.modal-content label {
       margin-top: 6px !important;
       margin-bottom: 2px !important;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
       margin-bottom: 10px !important;
}

.modal-content h2 {
       margin-top: 0;
       margin-bottom: 18px;
       text-align: center;
       font-size: 22px;
       font-weight: 600;
}

.modal-buttons {
       display: flex;
       gap: 15px;
       margin-top: 24px;
}

.modal-buttons button {
       flex: 1;
       padding: 12px 0;
       font-size: 17px;
       border-radius: 10px;
       cursor: pointer;
       border: none;
       transition: 0.18s;
}

.modal-buttons .cancel {
       background: #e8e8e8;
       color: #222;
}

.modal-buttons .cancel:hover {
       background: #d5d5d5;
}

.modal-buttons .confirm {
       background: #1565C0;
       color: white;
}

.modal-buttons .confirm:hover {
       background: #0f4ea0;
}

body.modal-open {
    overflow: hidden !important;
}
