/* ===== SeedFlow – stile base ===== */

html, body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Transizione di pagina ===== */
.page-fade {
    animation: pageFade .28s ease both;
}

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

.content-area { padding-bottom: 32px; }

/* ===== Elenco Semine: righe a scheda su smartphone ===== */
@media (max-width: 599.98px) {
    .card-rows .mud-table-row {
        display: block;
        border: 1px solid #E1E7EB;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 6px 10px;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    }
    /* prima riga (ID) in evidenza come intestazione della scheda */
    .card-rows .mud-table-row .mud-table-cell:first-child {
        background: #EEF2F5;
        border-bottom: 1px solid #DDE3E8;
        margin: -6px -10px 6px;
        padding: 8px 10px;
        border-radius: 12px 12px 0 0;
        font-size: 1.05rem;
    }
    .card-rows .mud-table-cell {
        padding-top: 4px;
        padding-bottom: 4px;
    }
    /* etichetta campo un po' più marcata */
    .card-rows .mud-table-cell::before {
        font-weight: 600;
        color: #64748B;
    }
}

/* ===== Suggerimento rotazione (schermata Vista Serra) ===== */
.rotate-hint { display: none; }

@media (max-width: 959.98px) and (orientation: portrait) {
    .rotate-hint {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 1400;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 24px;
        background: #F6F8F9;
        color: #0F766E;
    }
    .rotate-hint .mud-icon-root {
        color: #0F766E;
        animation: rotateHint 2.2s ease-in-out infinite;
    }
}

@keyframes rotateHint {
    0%, 60% { transform: rotate(0deg); }
    80%, 100% { transform: rotate(-90deg); }
}

/* ===== Pulsantoni dashboard ===== */
.dash-tile {
    border-radius: 16px;
    padding: 18px 16px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
    user-select: none;
}

.dash-tile .mud-icon-root { color: #fff; }

.dash-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0,0,0,0.18); filter: saturate(1.05); }
.dash-tile:active { transform: scale(0.96); }

.dash-tile-title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.dash-tile-sub { font-size: 0.78rem; opacity: 0.92; }

/* ===== Pulsante principale (hero) della dashboard ===== */
.dash-hero {
    border-radius: 20px;
    padding: 26px 28px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.18);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
    user-select: none;
}

.dash-hero:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(0,0,0,0.24); filter: saturate(1.05); }
.dash-hero:active { transform: scale(0.98); }

.dash-hero-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.dash-hero .mud-icon-root { color: #fff; }
.dash-hero-title { font-weight: 800; font-size: 1.7rem; line-height: 1.15; }
.dash-hero-sub { font-size: 0.92rem; opacity: 0.92; margin-top: 2px; }

.dash-hero-badge {
    flex: 0 0 auto;
    min-width: 64px;
    text-align: center;
    background: rgba(255,255,255,0.22);
    border-radius: 14px;
    padding: 10px 14px;
    font-weight: 800;
    font-size: 1.9rem;
    line-height: 1;
}
.dash-hero-badge-label { display: block; font-size: 0.62rem; font-weight: 600; opacity: 0.9; margin-top: 4px; }

@media (max-width: 600px) {
    .dash-hero-title { font-size: 1.35rem; }
    .dash-hero { padding: 20px; }
}

/* ===== Statistiche (KPI card + barre) ===== */
.stat-card {
    border-radius: 14px;
    padding: 16px 18px;
    height: 100%;
    background: #fff;
    border: 1px solid #E6EAED;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-card.accent { color: #fff; border: none; }
.stat-label { font-size: 0.8rem; opacity: 0.85; font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1.1; margin-top: 4px; }
.stat-sub { font-size: 0.75rem; opacity: 0.8; margin-top: 2px; }

.stat-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-bar-name { flex: 0 0 40%; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-track { flex: 1; background: #eef1f4; border-radius: 6px; height: 18px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg,#0F766E,#22C55E); min-width: 2px; }
.stat-bar-value { flex: 0 0 auto; font-size: 0.82rem; font-weight: 700; min-width: 46px; text-align: right; }

.stat-cols { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; overflow-x: auto; }
.stat-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1 0 34px; height: 100%; }
.stat-col-bar { width: 60%; min-width: 14px; background: linear-gradient(180deg,#22C55E,#0F766E); border-radius: 5px 5px 0 0; min-height: 2px; }
.stat-col-val { font-size: 0.66rem; font-weight: 700; margin-bottom: 3px; color: #334155; }
.stat-col-lbl { font-size: 0.66rem; color: #64748B; margin-top: 4px; white-space: nowrap; }

/* ===== Barra di navigazione inferiore (mobile) ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid #E6EAED;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: stretch;
    gap: 2px;
}

.mobile-bottom-nav .bnav {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    text-decoration: none;
    color: #64748B;
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
    transition: color .15s ease, background-color .15s ease, transform .08s ease;
}

.mobile-bottom-nav .bnav:active { transform: scale(0.92); }

.mobile-bottom-nav .bnav.active {
    color: #0F766E;
    background: #E6F2F0;
}

/* Mostra la barra e lascia spazio sotto il contenuto solo su schermi piccoli */
@media (max-width: 959.98px) {
    .mobile-bottom-nav { display: flex; }
    .content-area { padding-bottom: 84px !important; }
}

h1:focus {
    outline: none;
}

/* AppBar flat con bordo inferiore (look moderno) */
.appbar-border {
    border-bottom: 1px solid #E6EAED;
}

/* Drawer con bordo destro sottile invece dell'ombra */
.drawer-border {
    border-right: 1px solid #E6EAED;
}

/* Drawer a colonna: logo fisso in alto, menu scrollabile sotto */
.mud-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* ===== Validazione form ===== */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16A34A;
}

.invalid {
    outline: 1px solid #DC2626;
}

.validation-message {
    color: #DC2626;
}

/* ===== Blazor error UI ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "Si è verificato un errore.";
    }
