/* ===== Delineo Design System ===== */
:root {
    /* Brand */
    --brand-50:  #F4EFFE;
    --brand-100: #E5DBFB;
    --brand-200: #C9BEF0;
    --brand-300: #A993E0;
    --brand-500: #6B46C1;
    --brand-600: #5B3FBF;
    --brand-700: #4A2FA5;

    /* Pastel surfaces (cards in evidenza) */
    --pastel-blue:    #D6E4F5;
    --pastel-lavender:#E5DCF7;
    --pastel-mint:    #D6EDE3;
    --pastel-purple:  #DCD0F0;

    /* Neutrals */
    --bg:        #F2EEFB;
    --surface:   #FFFFFF;
    --surface-2: #FAF7FF;
    --border:    #E6E1F2;
    --text:      #1F1B33;
    --text-muted:#7B7A92;

    /* Accents */
    --accent-orange: #F4A06A;
    --accent-red:    #EF4444;
    --accent-green:  #10B981;

    /* Radius / shadow */
    --radius-sm: 10px;
    --radius:    14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-sm: 0 1px 2px rgba(31,27,51,.04), 0 1px 3px rgba(31,27,51,.06);
    --shadow:    0 4px 12px rgba(31,27,51,.06), 0 1px 3px rgba(31,27,51,.04);
    --shadow-lg: 0 12px 32px rgba(91,63,191,.12), 0 4px 12px rgba(31,27,51,.06);

    /* Sidebar */
    --sidebar-w: 80px;
}

* { box-sizing: border-box; }

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv11','ss01';
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body { margin: 0; min-height: 100vh; }

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
h1 { font-size: 1.85rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }

.text-muted { color: var(--text-muted) !important; }

/* ----- Loading splash ----- */
.app-loading {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: var(--bg);
    gap: 1.25rem;
}
.app-loading-logo {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent-orange), #ff7c5e);
    color: white; font-weight: 800; font-size: 2rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg);
    animation: pulse 1.6s ease-in-out infinite;
}
.app-loading-text { color: var(--text-muted); font-size: .9rem; }
@keyframes pulse {
    0%,100% { transform: scale(1); }
    50%     { transform: scale(1.06); }
}

/* ----- Buttons ----- */
.btn {
    border-radius: 999px;
    font-weight: 600;
    padding: .55rem 1.1rem;
    border: none;
    transition: transform .08s, box-shadow .15s, background-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus, .btn:active:focus {
    box-shadow: 0 0 0 3px rgba(107,70,193,.25) !important;
    outline: none;
}

.btn-primary,
.btn-primary:focus {
    background: var(--brand-600);
    color: #fff;
}
.btn-primary:hover { background: var(--brand-700); color: #fff; }

.btn-outline-primary {
    background: transparent;
    color: var(--brand-600);
    border: 1.5px solid var(--brand-200);
}
.btn-outline-primary:hover {
    background: var(--brand-50);
    color: var(--brand-700);
    border-color: var(--brand-300);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-outline-secondary:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--brand-200);
}

.btn-link { padding: .25rem .5rem; }

/* ----- Forms ----- */
.form-control, .form-select {
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--surface);
    padding: .65rem .9rem;
    font-size: .95rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-300);
    box-shadow: 0 0 0 4px rgba(107,70,193,.12);
}
.form-label {
    font-weight: 600;
    font-size: .88rem;
    color: var(--text);
    margin-bottom: .35rem;
}

/* ----- Cards ----- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card .card-body { padding: 1.25rem 1.4rem; }

/* ----- Badges / chips ----- */
.badge {
    background: var(--brand-100) !important;
    color: var(--brand-700) !important;
    font-weight: 600;
    border-radius: 999px;
    padding: .35em .75em;
    font-size: .75rem;
}

/* ----- Lists ----- */
.list-group { border-radius: var(--radius); overflow: hidden; }
.list-group-item {
    border: 1px solid var(--border);
    background: var(--surface);
    padding: .9rem 1.1rem;
}

/* ----- Alerts ----- */
.alert { border-radius: var(--radius); border: none; padding: .8rem 1.1rem; }
.alert-danger  { background: #FEE2E2; color: #991B1B; }
.alert-warning { background: #FEF3C7; color: #92400E; }
.alert-success { background: #D1FAE5; color: #065F46; }

/* ----- Validation ----- */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--accent-green); }
.invalid { outline: 1px solid var(--accent-red); }
.validation-message { color: var(--accent-red); font-size: .85rem; }

/* ----- Page error UI ----- */
#blazor-error-ui {
    color-scheme: light only;
    background: #FEE2E2;
    color: #7F1D1D;
    bottom: 0; left: 0; width: 100%;
    box-shadow: 0 -4px 12px rgba(0,0,0,.08);
    box-sizing: border-box;
    display: none;
    padding: .75rem 1.25rem;
    position: fixed;
    z-index: 1000;
    font-weight: 500;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem; top: .5rem;
    font-size: 1.25rem;
}

.blazor-error-boundary {
    background: #FEE2E2;
    color: #7F1D1D;
    border-radius: var(--radius);
    padding: 1rem;
}
.blazor-error-boundary::after { content: "Si è verificato un errore."; }

code { color: #C026D3; background: #FAE8FF; padding: .1em .35em; border-radius: 6px; }

/* ----- Page header ----- */
.page-head { margin-bottom: 1.75rem; }
.page-head.with-action {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-head h1 { margin: 0 0 .35rem; font-size: 1.75rem; }
.page-sub { color: var(--text-muted); margin: 0; font-size: .98rem; }

/* Empty state (riusabile) */
.empty-state {
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
}
.empty-state .empty-emoji { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state h3 { margin: 0 0 .5rem; }
.empty-state p { color: var(--text-muted); margin: 0 0 1rem; }

/* Skeleton (riusabile) */
.skeleton {
    background: linear-gradient(90deg, #ECE6FA 0%, #F4F0FC 50%, #ECE6FA 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
    border-radius: var(--radius-lg);
}
.skeleton-post   { height: 200px; margin-bottom: 1rem; }
.skeleton-detail { height: 360px; margin-bottom: 1.5rem; }
@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ----- Auth pages (Login / Register) ----- */
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.25rem 2.25rem 1.75rem;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}
.auth-card-wide { max-width: 520px; }
.auth-logo {
    width: 56px; height: 56px;
    margin: 0 auto 1.1rem;
    filter: drop-shadow(0 8px 18px rgba(244,160,106,.4));
}
.auth-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 .35rem;
    letter-spacing: -.015em;
}
.auth-sub {
    text-align: center;
    color: var(--text-muted);
    margin: 0 0 1.75rem;
    font-size: .94rem;
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-field { display: flex; flex-direction: column; }
.auth-field .form-label { margin-bottom: .35rem; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.auth-hint { color: var(--text-muted); font-size: .8rem; margin-top: .35rem; }
.auth-optional { color: var(--text-muted); font-weight: 400; font-size: .8rem; }
.auth-submit {
    margin-top: .25rem;
    padding: .75rem 1rem;
    font-size: .98rem;
    width: 100%;
}
.auth-alt {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--text-muted);
    font-size: .9rem;
}
.auth-alt a { font-weight: 600; }
@media (max-width: 480px) {
    .auth-card { padding: 1.5rem 1.25rem; border-radius: var(--radius-lg); }
    .auth-row { grid-template-columns: 1fr; }
}
