/* Casa Canazei – Calendario di godimento; un solo CSS per creare, modificare e consultare. */
.ccg-manage, .ccg-public { --ccg-red: #A22B24; --ccg-dark: #1f2937; color: inherit; }
.ccg-manage *, .ccg-public * { box-sizing: border-box; }
.ccg-notice { background: #e8f7e8; color: #226622; border: 1px solid #b7e0b7; border-radius: 8px; padding: 12px 16px; margin: 0 0 20px; }
.ccg-hint { background: #fff8e7; border-left: 3px solid #c99529; padding: 12px 15px; margin: 16px 0; }
.ccg-manager-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 15px; margin-bottom: 22px; }
.ccg-panel { background: #fff; padding: 18px; border: 1px solid #e6e6e6; border-radius: 12px; }
.ccg-panel h3 { margin: 0 0 10px; font-size: 18px; }
.ccg-panel p { font-size: 14px; }
.ccg-select-form, .ccg-fields { display: grid; gap: 10px; }
.ccg-select-form label, .ccg-fields label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.ccg-select-form select, .ccg-fields select, .ccg-fields input { width: 100%; padding: 11px 12px; border: 1px solid #ddd; border-radius: 8px; background: #fff; min-width: 0; }
.ccg-select-form button, .ccg-public-picker button { background: var(--ccg-red); color: #fff; border: 0; padding: 11px 15px; border-radius: 8px; cursor: pointer; }
.ccg-select-form button:hover, .ccg-public-picker button:hover { background: #7f211c; color: #fff; }
.ccg-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
/* I tre controlli principali devono condividere lo stesso design Elementor. */
.ccg-manage .calendario-godimento .ccg-fields input[type="text"],
.ccg-manage .calendario-godimento .ccg-fields select {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 11px 12px !important;
    font: inherit;
    font-size: 16px;
    line-height: 1.35;
    color: #262626;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    box-sizing: border-box;
}
.ccg-manage .calendario-godimento .ccg-fields input[type="text"]:focus-visible,
.ccg-manage .calendario-godimento .ccg-fields select:focus-visible {
    outline: 2px solid var(--ccg-red);
    outline-offset: 2px;
}

.calendario-godimento form { width: 100%; max-width: 100%; margin: 0 auto; padding: 20px; background: #fff; border: 1px solid #e6e6e6; border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.04); font-family: inherit; }
.calendario-godimento .riga { display: grid; grid-template-columns: minmax(75px,1.2fr) minmax(105px,1fr) minmax(105px,1fr) minmax(75px,.8fr) minmax(85px,1fr) 38px 38px 46px 38px; gap: 8px; margin-bottom: 10px; padding: 10px; background: #fafafa; border: 1px solid #eee; border-radius: 10px; position: relative; align-items: center; }
.calendario-godimento .riga input[type=text], .calendario-godimento .riga input[type=date], .calendario-godimento .riga select { width: 100%; min-width: 0; padding: 10px 12px; margin: 6px 0; border: 1px solid #ddd; border-radius: 8px; background: #fff; font-size: 14px; transition: border-color .2s ease; }
.calendario-godimento input:focus-visible, .calendario-godimento select:focus-visible, .ccg-manage button:focus-visible, .ccg-public button:focus-visible { outline: 2px solid var(--ccg-red); outline-offset: 2px; }
.calendario-godimento .riga button { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0; border: none; color: #fff; cursor: pointer; line-height: 1; transition: transform .2s ease, background .2s ease; }
.calendario-godimento .inserisci-riga { width: 32px; height: 32px; border-radius: 50%; background: #2e7d32; font-size: 18px; font-weight: 700; }
.calendario-godimento .inserisci-riga:hover { background: #1b5e20; transform: scale(1.08); }
.calendario-godimento .inserisci-chiusura-inline { width: 32px; height: 32px; border-radius: 50%; background: #8e24aa; font-size: 14px; font-weight: 700; }
.calendario-godimento .inserisci-chiusura-inline:hover { background: #6a1b9a; transform: scale(1.08); }
.calendario-godimento .duplica-riga { width: 42px; height: 42px; background: #2d2d2d; border-radius: 8px; }
.calendario-godimento .duplica-riga:hover { background: #444; }
.calendario-godimento .elimina-riga { width: 32px; height: 32px; background: #ff4d4d; border-radius: 50%; font-size: 16px; }
.calendario-godimento .elimina-riga:hover { background: #d93636; }
.calendario-godimento .riga button::after { content: attr(aria-label); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px); background: rgba(0,0,0,.9); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: 400; line-height: 1.2; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s ease, transform .15s ease; z-index: 100; }
.calendario-godimento .riga button:is(:hover,:focus-visible)::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.ccg-action-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.ccg-action-bottom button { margin: 0; padding: 10px 14px; border: none; border-radius: 8px; background: #2d2d2d; color: #fff; cursor: pointer; font-size: 14px; }
.ccg-action-bottom .aggiungi-chiusura { background: var(--ccg-red); }
.ccg-action-bottom .aggiungi-chiusura:hover { background: #7f211c; }
.ccg-action-bottom .aggiungi-riga:hover { background: #444; }
.calendario-godimento input[type=submit] { display: inline-block; margin-top: 20px; padding: 12px 18px; background: #1a73e8; color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.calendario-godimento input[type=submit]:hover { background: #1557b0; }
/* Public-facing table */
/* Selettore stagioni: campo a tutta larghezza e azioni affiancate. */
.ccg-public-picker { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 20px; }
.ccg-public-picker label { display: block; font-weight: 600; }
.ccg-public-picker select { width: 100%; max-width: 100%; min-width: 0; min-height: 42px; border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; background: #fff; }
.ccg-public-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.ccg-public-actions button { flex: 0 0 auto; display: inline-flex; justify-content: center; align-items: center; width: auto; min-height: 44px; margin: 0; padding: 11px 16px; white-space: nowrap; }
.ccg-public-actions .scarica-pdf-godimento { background: #1a73e8; color: #fff; }
.ccg-public-actions .scarica-pdf-godimento:hover { background: #1557b0; color: #fff; }
.tabella-godimento-wrap { max-width: 1000px; margin: 0 auto; padding: 24px; background: #fff; border: 1px solid #e8e8e8; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.05); overflow-x: auto; }
.tabella-godimento-wrap h2 { margin: 0 0 20px; font-size: 26px; font-weight: 600; color: #222; }
.tabella-godimento { width: 100%; border-collapse: collapse; border-spacing: 0; font-size: 15px; background: #fff; border-radius: 10px; }
.tabella-godimento thead { background: #1f2937; color: #fff; }
.tabella-godimento th { padding: 14px 16px; text-align: left; font-weight: 600; border: none; white-space: nowrap; color: #fff; background: #1f2937; }
.tabella-godimento td { padding: 14px 16px; border-bottom: 1px solid #eee; color: #333; vertical-align: middle; }
.tabella-godimento tbody tr:nth-child(even) { background: #fafafa; }
.tabella-godimento tbody tr:hover { background: #f3f6fb; }
.tabella-godimento tbody tr:last-child td { border-bottom: none; }
.scarica-pdf-godimento { margin-bottom: 20px; padding: 11px 18px; background: #1a73e8; color: #fff; border: 0; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 15px; }
.scarica-pdf-godimento:hover { background: #1557b0; color: #fff; }
.tabella-godimento .riga-chiusura-output td { font-weight: 600; background: #f5f5f5; }
@media (max-width: 1100px) and (min-width: 769px) {
    .calendario-godimento .riga { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .calendario-godimento .riga button { width: 100%; height: 36px; border-radius: 8px; }
}
@media (max-width: 768px) {
    .ccg-fields { grid-template-columns: 1fr; }
    .calendario-godimento form { padding: 15px; }
    .calendario-godimento .riga { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
    .calendario-godimento .riga button { width: 100%; height: 40px; border-radius: 8px; }
    .calendario-godimento .riga button::after { display: none; }
    .ccg-action-bottom { display: block; }
    .ccg-action-bottom button, .calendario-godimento input[type=submit] { width: 100%; margin-top: 10px; }
    .tabella-godimento-wrap { width: 100%; max-width: 100%; overflow-x: hidden; padding: 16px; }
    .tabella-godimento { min-width: 0 !important; width: 100% !important; max-width: 100% !important; border: none; }
    .tabella-godimento, .tabella-godimento tbody, .tabella-godimento tr, .tabella-godimento td { display: block; width: 100%; max-width: 100%; }
    .tabella-godimento thead { display: none; }
    .tabella-godimento tr { margin-bottom: 14px; background: #fff; border: 1px solid #e6e6e6; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
    .tabella-godimento td { display: grid; grid-template-columns: minmax(75px,90px) minmax(0,1fr); gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f0f0f0; text-align: left; font-size: 14px; overflow-wrap: anywhere; }
    .tabella-godimento td:last-child { border-bottom: none; }
    .tabella-godimento td::before { content: attr(data-label); font-weight: 600; color: #222; text-align: left; }
    .ccg-public-actions { flex-direction: column; align-items: stretch; gap: 10px; }
    .ccg-public-actions button { flex: 0 0 auto; width: 100%; white-space: normal; }
}
@media print {
    @page { size: A4 portrait; margin: 12mm; }
    header, footer, .elementor-location-header, .elementor-location-footer, .ccg-public-picker, .scarica-pdf-godimento { display: none !important; }
    .tabella-godimento-wrap { width: 100% !important; max-width: 100% !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; overflow: visible !important; background: #fff !important; }
    .tabella-godimento-wrap h2 { text-align: center !important; font-size: 18px !important; margin: 0 0 18px !important; color: #000 !important; }
    .tabella-godimento { display: table !important; width: 100% !important; max-width: 100% !important; border-collapse: collapse !important; table-layout: fixed !important; font-size: 11px !important; }
    .tabella-godimento thead { display: table-header-group !important; }
    .tabella-godimento tbody { display: table-row-group !important; }
    .tabella-godimento tr { display: table-row !important; margin: 0 !important; box-shadow: none !important; border: 0 !important; }
    .tabella-godimento th, .tabella-godimento td { display: table-cell !important; width: auto !important; max-width: none !important; border: 1px solid #000 !important; padding: 5px 7px !important; font-size: 11px !important; text-align: center !important; vertical-align: middle !important; color: #000 !important; background: #fff !important; overflow-wrap: break-word; }
    .tabella-godimento td::before { content: none !important; display: none !important; }
    .tabella-godimento tr { break-inside: avoid; page-break-inside: avoid; }
    .tabella-godimento thead { background: #fff !important; }
}


/* 1.0.2 – Solo nella stampa del calendario pubblico, nascondi anche il
   pulsante Elementor di ritorno alla home e altri controlli di navigazione.
   Non nascondiamo il widget Shortcode che contiene il calendario. */
@media print {
    body:has(.ccg-public) .elementor-widget-button,
    body:has(.ccg-public) .elementor-button-wrapper,
    body:has(.ccg-public) a.elementor-button,
    body:has(.ccg-public) .wp-block-button,
    body:has(.ccg-public) .cta-wrapper {
        display: none !important;
    }
}
