/* ================================================
   admin.css — pagina gestione contenuti
   Dipende da: base.css
================================================ */

:root {
    --adm-accent:      #ff7000;
    --adm-accent-lt:   #fff4eb;
    --adm-accent-dk:   #c45500;
    --adm-radius:      14px;
    --adm-sidebar-w:   260px;
}

/* ── Layout ── */
.adm-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    padding-top: 64px;
}

/* ── Sidebar ── */
.adm-sidebar {
    width: var(--adm-sidebar-w);
    flex-shrink: 0;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(10px);
    border-right: 1px solid #f3e8d8;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.adm-sidebar-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 0.5rem 0.5rem 0.25rem;
    margin-top: 0.75rem;
}

.adm-sidebar-title:first-child { margin-top: 0; }

.adm-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    width: 100%;
    text-align: left;
}

.adm-nav-btn:hover   { background: var(--adm-accent-lt); color: var(--adm-accent); }
.adm-nav-btn.active  { background: var(--adm-accent); color: #fff; }
.adm-nav-btn svg     { width: 16px; height: 16px; flex-shrink: 0; }

.adm-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
    background: var(--adm-accent);
    color: #fff;
    border: none;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.adm-new-btn:hover  { background: var(--adm-accent-dk); }
.adm-new-btn:active { transform: scale(0.97); }

/* ── Main area ── */
.adm-main {
    flex: 1;
    padding: 2rem 1.5rem;
    min-width: 0;
}

.adm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.adm-page-title {
    font-family: "Berlin Sans FB Demi", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

/* ── Lista contenuti ── */
.adm-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.9);
    border-radius: var(--adm-radius);
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}

.adm-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6b7280;
    background: #fafafa;
    border-bottom: 1px solid #f3f4f6;
}

.adm-table td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #374151;
    border-bottom: 1px solid #f9fafb;
    vertical-align: middle;
}

.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr:hover td     { background: #fffbf7; }

.adm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
}
.adm-badge--ok  { background: #dcfce7; color: #166534; }
.adm-badge--no  { background: #f3f4f6; color: #6b7280; }

.adm-row-actions { display: flex; gap: 0.4rem; }

.adm-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 8px; border: none; cursor: pointer;
    transition: background 0.15s;
}
.adm-icon-btn--edit   { background: var(--adm-accent-lt); color: var(--adm-accent); }
.adm-icon-btn--delete { background: #fee2e2; color: #dc2626; }
.adm-icon-btn:hover   { opacity: 0.8; }
.adm-icon-btn svg     { width: 15px; height: 15px; }

/* ── Form panel ── */
.adm-panel {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-radius: var(--adm-radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    padding: 2rem;
    max-width: 860px;
}

.adm-panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--adm-accent-lt);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.adm-panel-title::before {
    content: '';
    display: block; width: 4px; height: 1.1rem;
    background: var(--adm-accent); border-radius: 2px;
}

/* ── Form fields ── */
.adm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.adm-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.adm-full { grid-column: 1 / -1; }

.adm-field { display: flex; flex-direction: column; gap: 0.3rem; }

.adm-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #374151;
}

.adm-label span { color: #dc2626; margin-left: 2px; }   /* asterisco obbligatorio */

.adm-input,
.adm-select,
.adm-textarea {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    font-size: 0.9rem;
    color: #111827;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.adm-input:focus,
.adm-select:focus,
.adm-textarea:focus {
    outline: none;
    border-color: var(--adm-accent);
    box-shadow: 0 0 0 3px rgba(255,112,0,0.12);
    background: #fff;
}

.adm-input.error,
.adm-select.error,
.adm-textarea.error { border-color: #dc2626; }

.adm-textarea { resize: vertical; min-height: 140px; line-height: 1.6; }

/* ── Tipo switcher ── */
.adm-type-switcher {
    display: flex;
    background: #f3f4f6;
    border-radius: 9999px;
    padding: 3px;
    gap: 2px;
    width: fit-content;
    margin-bottom: 1.5rem;
}

.adm-type-btn {
    padding: 0.4rem 1.2rem;
    border-radius: 9999px;
    border: none;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    background: none;
    color: #6b7280;
}

.adm-type-btn.active {
    background: var(--adm-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255,112,0,0.3);
}

/* ── Sezione evento (condizionale) ── */
.adm-evento-section {
    border-top: 1px solid #f3e8d8;
    margin-top: 1rem;
    padding-top: 1rem;
}

/* ── Checkbox grid (argomenti, luoghi) ── */
.adm-check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #fafafa;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    max-height: 140px;
    overflow-y: auto;
}

.adm-check-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.adm-check-label:hover { background: var(--adm-accent-lt); }

.adm-check-label input[type="checkbox"] {
    accent-color: var(--adm-accent);
    width: 15px; height: 15px;
}

/* ── Comune search ── */
.adm-comune-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.adm-comune-search {
    position: relative;
}

.adm-comune-results {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid var(--adm-accent);
    border-top: none;
    border-radius: 0 0 9px 9px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    display: none;
}

.adm-comune-results.open { display: block; }

.adm-comune-opt {
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
    color: #111827;
    cursor: pointer;
    transition: background 0.12s;
}

.adm-comune-opt:hover          { background: var(--adm-accent-lt); }
.adm-comune-opt .comune-region { font-size: 0.75rem; color: #9ca3af; margin-left: 4px; }

.adm-comune-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.adm-comune-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--adm-accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px 3px 10px;
    border-radius: 9999px;
}

.adm-comune-tag button {
    background: none; border: none; cursor: pointer;
    color: #fff; opacity: 0.7; font-size: 1rem;
    line-height: 1; padding: 0; margin-left: 2px;
    transition: opacity 0.15s;
}
.adm-comune-tag button:hover { opacity: 1; }

/* ── Toggle approvazione ── */
.adm-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.adm-toggle {
    position: relative;
    width: 40px; height: 22px;
    flex-shrink: 0;
}

.adm-toggle input { opacity: 0; width: 0; height: 0; }

.adm-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
}

.adm-toggle input:checked + .adm-toggle-slider { background: var(--adm-accent); }

.adm-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 3px; left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.adm-toggle input:checked + .adm-toggle-slider::before { transform: translateX(18px); }

/* ── Bottoni form ── */
.adm-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f3f4f6;
}

.adm-submit-btn {
    padding: 0.65rem 2rem;
    background: var(--adm-accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border: none; border-radius: 9999px; cursor: pointer;
    box-shadow: 0 4px 12px rgba(255,112,0,0.28);
    transition: background 0.2s, transform 0.15s;
}
.adm-submit-btn:hover   { background: var(--adm-accent-dk); }
.adm-submit-btn:active  { transform: scale(0.97); }
.adm-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.adm-cancel-btn {
    padding: 0.65rem 1.5rem;
    background: #f3f4f6;
    color: #374151;
    font-weight: 600;
    font-size: 0.95rem;
    border: none; border-radius: 9999px; cursor: pointer;
    transition: background 0.15s;
}
.adm-cancel-btn:hover { background: #e5e7eb; }

.adm-form-status {
    font-size: 0.85rem; font-weight: 600;
    min-height: 1.2em; margin-left: auto;
}
.adm-form-status--ok  { color: #16a34a; }
.adm-form-status--err { color: #dc2626; }

/* ── Delete confirm modal ── */
.adm-modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.adm-modal {
    background: #fff;
    border-radius: var(--adm-radius);
    padding: 2rem;
    max-width: 380px; width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.adm-modal h3 { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.75rem; }
.adm-modal p  { font-size: 0.9rem; color: #6b7280; margin-bottom: 1.5rem; }
.adm-modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

.adm-modal-del {
    padding: 0.55rem 1.5rem;
    background: #dc2626; color: #fff;
    font-weight: 700; border: none;
    border-radius: 9999px; cursor: pointer;
    transition: background 0.15s;
}
.adm-modal-del:hover { background: #b91c1c; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .adm-sidebar { display: none; }
    .adm-grid, .adm-grid--3 { grid-template-columns: 1fr; }
    .adm-panel { padding: 1.25rem; }
    .adm-main  { padding: 1rem; }
}

/* ================================================
   FOTO MANAGER
================================================ */
.foto-drop-zone {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
    position: relative;
}

.foto-drop-zone.dragover {
    border-color: var(--adm-accent);
    background: var(--adm-accent-lt);
}

.foto-drop-zone input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.foto-drop-zone p { margin: 0; color: #9ca3af; font-size: 0.9rem; pointer-events: none; }
.foto-drop-zone strong { color: var(--adm-accent); }

/* Griglia foto drag&drop */
.foto-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    min-height: 60px;
}

.foto-item {
    position: relative;
    width: 120px;
    height: 90px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
    transition: box-shadow 0.2s, transform 0.15s;
}

.foto-item:active { cursor: grabbing; }

.foto-item.dragging {
    opacity: 0.45;
    transform: scale(0.95);
    box-shadow: none;
}

.foto-item.drag-over {
    border-color: var(--adm-accent);
    box-shadow: 0 0 0 3px rgba(255,112,0,0.2);
}

.foto-item--cover {
    border-color: var(--adm-accent);
    box-shadow: 0 0 0 2px var(--adm-accent);
}

.foto-item img {
    width: 100%; height: 100%; object-fit: cover; pointer-events: none;
}

.foto-item-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 55%);
    display: flex; align-items: flex-end; justify-content: space-between;
    padding: 4px 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.foto-item:hover .foto-item-overlay { opacity: 1; }

.foto-cover-badge {
    position: absolute; top: 4px; left: 4px;
    background: var(--adm-accent); color: #fff;
    font-size: 0.62rem; font-weight: 800;
    padding: 1px 6px; border-radius: 9999px;
    pointer-events: none;
    letter-spacing: 0.05em;
}

.foto-del-btn {
    background: rgba(220,38,38,0.85); border: none;
    color: #fff; width: 22px; height: 22px;
    border-radius: 50%; cursor: pointer; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.foto-del-btn:hover { background: #dc2626; }

.foto-upload-btn {
    width: 120px; height: 90px;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.3rem; color: #9ca3af; font-size: 0.78rem;
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}
.foto-upload-btn:hover { border-color: var(--adm-accent); color: var(--adm-accent); }
.foto-upload-btn input[type="file"] { display: none; }

.foto-reorder-hint {
    font-size: 0.75rem; color: #9ca3af; margin-top: 0.4rem;
    display: flex; align-items: center; gap: 0.3rem;
}

/* Upload progress overlay */
.foto-uploading {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; color: var(--adm-accent); font-weight: 700;
}

/* ================================================
   RICH TEXT EDITOR (Quill)
================================================ */
.adm-editor-wrap {
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    overflow: hidden;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.adm-editor-wrap:focus-within {
    border-color: var(--adm-accent);
    box-shadow: 0 0 0 3px rgba(255,112,0,0.12);
    background: #fff;
}

.ql-toolbar {
    border: none !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: #f9fafb;
    border-radius: 0 !important;
}

.ql-container {
    border: none !important;
    font-size: 0.95rem !important;
    min-height: 160px;
}

.ql-editor {
    min-height: 160px;
    line-height: 1.7;
    color: #111827;
}

.ql-editor p { margin-bottom: 0.5rem; }

/* Banner informativo guest */
.adm-guest-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: #fffbeb;
    border: 1.5px solid #fbbf24;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    color: #92400e;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}
 
.adm-guest-banner a {
    color: #ff7000;
    font-weight: 700;
    text-decoration: none;
}
 
.adm-guest-banner a:hover {
    text-decoration: underline;
}
 
/* Messaggio di successo dopo invio guest */
.adm-form-status--ok {
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    font-weight: 600;
    display: block;
    margin-top: 0.5rem;
}
 
.adm-form-status--err {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    font-weight: 600;
    display: block;
    margin-top: 0.5rem;
}