/* ==========================================================
   assets/agenzia-admin.css
   Aspetto comune dell'area riservata: barra in alto con menu a gruppi
   e ritocchi a schede, pulsanti, tabelle e campi.
   Caricato da admin/header.php, quindi vale per tutte le pagine admin.
   I colori del marchio arrivano da branding_css_vars().
   ========================================================== */

:root {
    --ag-brand: #0F4C5C;
    --ag-on-brand: #FFFFFF;
    --ag-accent: #F2A93B;
    --ag-on-accent: #FFFFFF;
}

body.ag-admin {
    --ag-ink: #0E2238;
    --ag-muted: #47586B;
    --ag-line: #DCE3EA;
    --ag-line-strong: #C5D0DB;
    --ag-ground: #F3F6F9;
    --ag-soft: color-mix(in srgb, var(--ag-brand) 12%, #FFFFFF);
    /* le pagine admin usano gia' queste variabili */
    --primary: var(--ag-brand);
    --bg: var(--ag-ground);
    --text: var(--ag-ink);
    --border: var(--ag-line);
    background: var(--ag-ground);
    color: var(--ag-ink);
    font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
    padding: 16px;
}

/* ---------- barra in alto ---------- */
.ag-top {
    position: relative;
    z-index: 200;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
    margin: 0 0 16px;
    padding: 8px 14px;
    background: #13233A;
    color: #FFFFFF;
    border-radius: 16px;
    box-shadow: inset 0 -3px 0 var(--ag-brand), 0 14px 30px -24px rgba(19, 35, 58, .8);
    font-size: 14px;
    line-height: 1.3;
}
.ag-top a { text-decoration: none; }
.ag-top-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-right: 6px;
    color: #FFFFFF;
    font-family: 'Archivo', 'Trebuchet MS', system-ui, sans-serif; font-stretch: 115%;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.ag-top-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ag-brand); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); flex-shrink: 0; }
.ag-top-logo { height: 32px; width: auto; max-width: 140px; object-fit: contain; background: #FFFFFF; border-radius: 6px; padding: 2px; }
.ag-top-toggle, .ag-top-burger { display: none; }
.ag-top-nav { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; }
.ag-top-nav > a,
.ag-menu > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    color: #C9D4E0;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    list-style: none;
    user-select: none;
}
.ag-menu > summary::-webkit-details-marker { display: none; }
.ag-menu > summary::after { content: ''; width: 7px; height: 7px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.ag-top-nav > a:hover,
.ag-menu > summary:hover,
.ag-menu[open] > summary { background: #24405E; color: #FFFFFF; }
.ag-top-nav > a.is-active,
.ag-menu.is-active > summary { background: #24405E; color: #FFFFFF; box-shadow: inset 0 -3px 0 var(--ag-brand); }
.ag-menu { position: relative; }
.ag-menu-right { margin-left: auto; }
.ag-menu-list {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 210;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 230px;
    max-width: min(420px, 92vw);
    max-height: min(70vh, 560px);
    overflow-y: auto;
    padding: 6px;
    background: #FFFFFF;
    color: #0E2238;
    border: 1px solid #DCE3EA;
    border-radius: 12px;
    box-shadow: 0 24px 48px -20px rgba(14, 34, 56, 0.55);
}
.ag-menu-right .ag-menu-list { left: auto; right: 0; }
.ag-menu-wide .ag-menu-list { min-width: 320px; }
.ag-menu-list a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 8px;
    color: #0E2238;
    font-weight: 600;
    white-space: normal;
}
.ag-menu-list a small { font-size: 12px; font-weight: 500; color: #47586B; }
.ag-menu-list a:hover { background: #F3F6F9; }
.ag-menu-list a.is-active { background: var(--ag-soft, #E3F0F5); color: var(--ag-brand); }
.ag-menu-sep { height: 1px; margin: 5px 4px; background: #DCE3EA; }
.ag-menu-note { padding: 6px 10px 8px; font-size: 12px; color: #47586B; overflow-wrap: anywhere; }

.ag-admin-credit { font-size: 11px; color: #6b7280; text-align: center; padding: 14px 10px 18px; line-height: 1.5; }

/* ---------- ritocchi comuni alle pagine ---------- */
body.ag-admin .card {
    border: 1px solid var(--ag-line);
    border-radius: 14px;
    box-shadow: none;
}
body.ag-admin .card > h2:first-child,
body.ag-admin .card > h1:first-child {
    font-family: 'Archivo', 'Trebuchet MS', system-ui, sans-serif; font-stretch: 115%;
    font-size: 24px;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
body.ag-admin .btn { border-radius: 8px; font-weight: 600; }
body.ag-admin .btn-primary { background: var(--ag-brand); color: var(--ag-on-brand); }
body.ag-admin table th { color: var(--ag-muted); }
body.ag-admin input[type="text"],
body.ag-admin input[type="email"],
body.ag-admin input[type="password"],
body.ag-admin input[type="number"],
body.ag-admin input[type="date"],
body.ag-admin input[type="search"],
body.ag-admin select,
body.ag-admin textarea { border-radius: 8px; }
body.ag-admin :focus-visible { outline: 3px solid #F2B233; outline-offset: 1px; }

/* ---------- iscritti: elenco degli eventi ---------- */
.ag-evlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; margin: 14px 0 4px; }
.ag-evcard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: #FFFFFF;
    border: 1px solid var(--ag-line, #DCE3EA);
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
a.ag-evcard:hover { border-color: var(--ag-brand); box-shadow: 0 14px 28px -22px rgba(14, 34, 56, 0.6); }
.ag-evcard-date { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ag-brand); }
.ag-evcard-title { font-family: 'Archivo', 'Trebuchet MS', system-ui, sans-serif; font-stretch: 115%; font-size: 18px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.ag-evcard-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.ag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #E3E9EF; color: #0E2238; }
.ag-chip-ok { background: #DDEBF2; color: #0B4A63; }
.ag-chip-paid { background: #0B5A78; color: #FFFFFF; }
.ag-chip-wait { background: #FFF1CC; color: #6B4700; }
.ag-chip-pend { background: #FDE7E1; color: #9A2C12; }
.ag-evcard-open { font-size: 14px; font-weight: 700; color: var(--ag-brand); }
.ag-evhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; }
.ag-evhead h2 { margin: 0; }
.ag-evhead p { margin: 4px 0 0; font-size: 14px; color: var(--ag-muted, #47586B); }
.ag-evhead-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-back { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 14px; font-weight: 600; color: var(--ag-brand); text-decoration: none; }
.ag-past { margin-top: 18px; }
.ag-past > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.ag-allsubs > summary { cursor: pointer; font-family: 'Archivo', 'Trebuchet MS', system-ui, sans-serif; font-stretch: 115%; font-size: 20px; font-weight: 700; padding: 2px 0; }
.ag-allsubs[open] > summary { margin-bottom: 10px; }

/* ---------- iscritti: tabella di un evento su schermi larghi ----------
   La pagina imposta colonne tutte uguali: qui do piu' spazio a nome e contatti
   e meno alle colonne con una sola casella. Sotto i 1100 px resta la vista a schede. */
html.ag-admin-root, html.ag-admin-root body.ag-admin { background: #F3F6F9 !important; }
:where(body.ag-admin) a { color: var(--ag-brand); }
@media (min-width: 1101px) {
    body.ag-admin table[id^="table-event-"] th:nth-child(1) { width: 3.1%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(2) { width: 4%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(3) { width: 9.9%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(4) { width: 13.4%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(5) { width: 4.5%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(6) { width: 6.5%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(7) { width: 8.8%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(8) { width: 5.7%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(9) { width: 5.7%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(10) { width: 9.3%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(11) { width: 4.2%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(12) { width: 7.4%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(13) { width: 6.5%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(14) { width: 4.2%; }
    body.ag-admin table[id^="table-event-"] th:nth-child(15) { width: 6.8%; }
    body.ag-admin table[id^="table-event-"] th,
    body.ag-admin table[id^="table-event-"] td { padding: 8px 6px !important; overflow-wrap: break-word !important; }
    body.ag-admin table[id^="table-event-"] th { font-size: 12px; line-height: 1.25; }
    body.ag-admin table[id^="table-event-"] .sub-badge { overflow-wrap: normal; word-break: normal; }
    body.ag-admin table[id^="table-event-"] .diet-flag { white-space: nowrap; }
}

/* ---------- accesso ---------- */
body.ag-login { --primary: var(--ag-brand); background: #13233A radial-gradient(circle at 85% 10%, color-mix(in srgb, var(--ag-brand) 55%, transparent), transparent 55%); font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif; }
body.ag-login .box { max-width: 400px; padding: 28px 24px; border-radius: 18px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7); }
body.ag-login .box h1 { font-family: 'Archivo', 'Trebuchet MS', system-ui, sans-serif; font-stretch: 115%; font-size: 26px; line-height: 1.15; margin: 0 0 4px; color: #0E2238; }
.ag-login-brand { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; font-weight: 700; color: #47586B; font-size: 14px; }
.ag-login-brand .ag-top-mark { box-shadow: none; }
body.ag-login label { margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: #47586B; }
body.ag-login input[type="text"],
body.ag-login input[type="password"] { height: 46px; padding: 0 12px; border: 1px solid #C5D0DB; border-radius: 8px; font-size: 16px; }
body.ag-login button { min-height: 48px; margin-top: 18px; border-radius: 10px; background: var(--ag-brand); color: var(--ag-on-brand); font-size: 16px; font-weight: 700; }
body.ag-login .links a { color: var(--ag-brand); font-weight: 600; }
body.ag-login .project-footer { color: #A9B8C8; background: transparent; }
body.ag-login .project-footer a { color: #C9D4E0; }

/* ---------- stampa ---------- */
@media print {
    .ag-top, .ag-admin-credit { display: none; }
}

/* ---------- schermi piccoli ---------- */
@media (max-width: 900px) {
    .ag-top { padding: 6px 10px; }
    .ag-top-burger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-left: auto;
        border-radius: 8px;
        cursor: pointer;
    }
    .ag-top-burger span,
    .ag-top-burger span::before,
    .ag-top-burger span::after { display: block; width: 22px; height: 2px; border-radius: 2px; background: #FFFFFF; position: relative; }
    .ag-top-burger span::before,
    .ag-top-burger span::after { content: ''; position: absolute; left: 0; }
    .ag-top-burger span::before { top: -7px; }
    .ag-top-burger span::after { top: 7px; }
    .ag-top-toggle { display: block; position: absolute; right: 10px; top: 6px; width: 44px; height: 44px; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
    .ag-top-nav { display: none; flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 0 4px; }
    .ag-top-toggle:checked ~ .ag-top-nav { display: flex; }
    .ag-top-nav > a, .ag-menu > summary { min-height: 44px; justify-content: space-between; white-space: normal; }
    .ag-menu-right { margin-left: 0; }
    .ag-menu-list,
    .ag-menu-right .ag-menu-list { position: static; max-width: none; max-height: none; margin: 4px 0 8px; box-shadow: none; }
    .ag-menu-wide .ag-menu-list { min-width: 0; }
}


/* ==========================================================
   Blocco 15: pagina "Sito agenzia" (admin/agency.php)
   ========================================================== */
.agy *, .agy *::before, .agy *::after { box-sizing: border-box; }
.agy { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; padding-bottom: 32px; }
.agy h1 { margin: 0; font-size: 30px; font-weight: 800; font-stretch: 118%; letter-spacing: -.02em; }
.agy h2 { margin: 0 0 12px; font-size: 21px; font-weight: 800; font-stretch: 110%; }
.agy h3 { margin: 22px 0 6px; font-size: 17px; font-weight: 800; }
.agy-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
.agy-head p { margin: 6px 0 0; color: var(--ag-muted, #47586B); max-width: 60ch; }
.agy-pick { display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.agy-pick label, .agy-field > label { font-size: 13px; font-weight: 700; color: var(--ag-muted, #47586B); }
.agy-card { background: #fff; border: 1px solid var(--ag-line, #DCE3EA); border-radius: 16px; padding: 22px; }
.agy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 14px 20px; }
.agy-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.agy-field small, .agy-muted { color: var(--ag-muted, #47586B); font-size: 13px; }
.agy input[type="text"], .agy input[type="email"], .agy input[type="tel"], .agy input[type="url"], .agy select, .agy textarea {
    width: 100%; min-height: 44px; padding: 9px 12px; border: 1.5px solid var(--ag-line-strong, #C5D0DB); border-radius: 10px; font: inherit; font-size: 15px; background: #fff;
}
.agy textarea { min-height: 70px; resize: vertical; }
.agy input:focus, .agy select:focus, .agy textarea:focus { outline: none; border-color: var(--ag-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ag-brand) 18%, transparent); }
.agy-affix { display: flex; align-items: stretch; }
.agy-affix input { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.agy-affix span { display: flex; align-items: center; padding: 0 12px; background: var(--ag-ground, #F3F6F9); border: 1.5px solid var(--ag-line-strong, #C5D0DB); border-left: 0; border-radius: 0 10px 10px 0; font-size: 14px; color: var(--ag-muted, #47586B); white-space: nowrap; }
.agy-checks { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.agy-checks label { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; }
.agy-checks input, .agy-thumb input { width: 18px; height: 18px; accent-color: var(--ag-brand); }
.agy-colors > div { display: flex; flex-wrap: wrap; gap: 16px; }
.agy-color { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.agy-color input { width: 48px; height: 40px; padding: 2px; border: 1.5px solid var(--ag-line-strong, #C5D0DB); border-radius: 10px; background: #fff; cursor: pointer; }
.agy-thumb { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.agy-thumb img { height: 56px; max-width: 180px; object-fit: contain; background: var(--ag-ground, #F3F6F9); border-radius: 8px; padding: 4px; }
.agy-thumb-wide img { height: 72px; max-width: 240px; object-fit: cover; padding: 0; }
.agy-thumb label { display: inline-flex; gap: 6px; align-items: center; }
.agy-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.agy-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--ag-line-strong, #C5D0DB); background: #fff; color: var(--ag-ink, #0E2238) !important; font: inherit; font-weight: 700; text-decoration: none !important; cursor: pointer; }
.agy-btn:hover { border-color: var(--ag-brand); }
.agy-btn-main { background: var(--ag-brand); border-color: var(--ag-brand); color: var(--ag-on-brand) !important; }
.agy-msg { padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.agy-ok { background: #E3F4EA; color: #1E5E3B; }
.agy-err { background: #FDE7E7; color: #8A1C1C; }
.agy-urls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.agy-urls a { padding: 6px 12px; border-radius: 999px; background: var(--ag-ground, #F3F6F9); font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.agy-help { margin-top: 16px; padding: 12px 16px; border: 1.5px dashed var(--ag-line-strong, #C5D0DB); border-radius: 12px; }
.agy-help summary { cursor: pointer; font-weight: 700; }
.agy-help pre { white-space: pre-wrap; background: #13233A; color: #E6EDF5; padding: 12px 14px; border-radius: 10px; font-size: 13px; overflow-x: auto; }
.agy-inline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.agy-inline h2 { margin-bottom: 4px; }
.agy-inline p { margin: 0; }
.agy-span2 { grid-column: 1 / -1; }
.agy-field textarea + small, .agy-field input + textarea { margin-top: 6px; }
/* blocco 17 */
.agy input[type="password"], .agy input[type="number"], .agy input[type="date"] {
    width: 100%; min-height: 44px; padding: 9px 12px; border: 1.5px solid var(--ag-line-strong, #C5D0DB); border-radius: 10px; font: inherit; font-size: 15px; background: #fff;
}
