/* ════════════════════════════════════════════════════════════════
   Maragna.NET — Global Design System
   Palette: navy #0D2B4E · gold #C9A84C · cream #faf8f4 · dark #081D35
   Fonts: Cormorant Garamond (serif) · Jost (sans)
   ════════════════════════════════════════════════════════════════ */

:root {
    --mg-navy:   #0D2B4E;
    --mg-navy-dk:#081D35;
    --mg-gold:   #C9A84C;
    --mg-gold-dk:#A07828;
    --mg-cream:  #faf8f4;
    --mg-muted:  #607176;
    --mg-border: rgba(13,43,78,.12);
}

h1:focus { outline: none; }

/* Validation states (Blazor forms) */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; font-size: .82rem; margin-top: .25rem; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 4px;
    margin: 1rem;
}
.blazor-error-boundary::after { content: "Si è verificato un errore."; }

#blazor-error-ui {
    background: var(--mg-gold);
    bottom: 0; left: 0; right: 0;
    position: fixed;
    z-index: 9999;
    padding: .85rem 1.5rem;
    display: none;
    font-family: 'Jost', system-ui, sans-serif;
    font-size: .88rem;
    color: var(--mg-navy-dk);
    font-weight: 500;
    text-align: center;
}
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 1rem; opacity: .7; }
#blazor-error-ui .dismiss:hover { opacity: 1; }

/* ── Logo testuale nell'header (Canvas) ───────────────────────── */
.mg-logo-text {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #0D2B4E;
    letter-spacing: .03em;
    text-decoration: none;
    transition: color .3s;
}
.mg-logo-text em { font-style: normal; font-weight: 400; color: #C9A84C; }
.mg-logo-text:hover { color: #A07828; }

/* ── Bottone oro pieno ─────────────────────────────────────────── */
.mg-btn-gold {
    display: inline-block;
    font-family: 'Jost', system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #0D2B4E !important;
    background: #C9A84C;
    border: 1px solid #C9A84C;
    padding: 15px 34px;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
    text-decoration: none;
}
.mg-btn-gold:hover {
    background: #A07828;
    border-color: #A07828;
    color: #fff !important;
}

/* Variante "outline" (stessa forma del gold, sfondo trasparente) */
.mg-btn-outline {
    display: inline-block;
    font-family: 'Jost', system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #C9A84C !important;
    background: transparent;
    border: 1px solid #C9A84C;
    padding: 15px 34px;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
    text-decoration: none;
}
.mg-btn-outline:hover {
    background: #C9A84C;
    border-color: #C9A84C;
    color: #0D2B4E !important;
}

/* ── Tabelle admin ─────────────────────────────────────────────── */
.mg-table-wrap {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    overflow-x: auto;
}
.mg-table-wrap table { margin-bottom: 0; }
.mg-table-wrap th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mg-muted);
    white-space: nowrap;
}
.mg-table-wrap td {
    font-size: .85rem;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Griglia entità (dashboard admin) ──────────────────────────── */
.entity-groups { display: flex; flex-direction: column; gap: 2rem; }
.entity-group h5 {
    font-weight: 700;
    color: #1d2b2f;
    margin-bottom: .75rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid var(--mg-gold);
    display: inline-block;
}
.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
}
.entity-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    background: white;
    border-radius: 10px;
    padding: .8rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    border-left: 3px solid var(--mg-navy);
    text-decoration: none;
    color: #1d2b2f;
    font-weight: 600;
    font-size: .88rem;
    transition: box-shadow .2s, transform .2s;
}
.entity-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    transform: translateY(-2px);
    color: var(--mg-gold-dk);
}
.entity-card.readonly { border-left-color: #adb5bd; }
.entity-card .badge-ro {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #e9ecef;
    color: #6c757d;
    border-radius: 6px;
    padding: .15rem .4rem;
    flex-shrink: 0;
}

/* ── Paginazione ───────────────────────────────────────────────── */
.mg-pager {
    display: flex;
    align-items: center;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1rem;
    font-size: .85rem;
    color: var(--mg-muted);
}
