* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #111827;
    color: #e5e7eb;
    margin: 0;
}

a { color: #60a5fa; }

/* Tabelle */
.table-dark-custom {
    width: 100%;
    border-collapse: collapse;
}
.table-dark-custom th {
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.table-dark-custom td {
    padding: 0.875rem 1rem;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s;
}
.table-dark-custom tr:hover td { background: rgba(59,130,246,0.05); }

/* Card generica */
.card-dark {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 1.5rem;
    animation: fadeInUp 0.4s ease both;
}

/* Badge stati */
.badge { padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-bozza { background: rgba(107,114,128,0.2); color: #9ca3af; border: 1px solid rgba(107,114,128,0.3); }
.badge-inviato { background: rgba(59,130,246,0.2); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-approvato { background: rgba(34,197,94,0.2); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.badge-rifiutato { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-attesa { background: rgba(234,179,8,0.2); color: #facc15; border: 1px solid rgba(234,179,8,0.3); }
.badge-parziale { background: rgba(59,130,246,0.2); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-pagata { background: rgba(34,197,94,0.2); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }

/* Bottoni */
.btn-primary-custom {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}
.btn-primary-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.4);
    color: white;
    text-decoration: none;
}

.btn-secondary-custom {
    background: rgba(255,255,255,0.06);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}
.btn-secondary-custom:hover {
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    text-decoration: none;
}

.btn-danger-custom {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger-custom:hover {
    background: rgba(239,68,68,0.25);
}

.btn-outline-custom {
    background: transparent;
    color: #60a5fa;
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-outline-custom:hover {
    background: rgba(59,130,246,0.1);
    color: #60a5fa;
    text-decoration: none;
}

/* Input */
.input-dark {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #e2e8f0;
    padding: 0.625rem 1rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}
.input-dark:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.input-dark::placeholder { color: #475569; }

select.input-dark option {
    background: #1e293b;
    color: #e2e8f0;
}

/* Form labels */
.form-label-dark {
    display: block;
    color: #94a3b8;
    font-size: 0.825rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

/* Modal dark */
.modal-dark {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    overflow: hidden;
}
.modal-dark-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-dark-header h5 {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.modal-dark-body { padding: 1.5rem; }
.modal-dark-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.btn-close-dark {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.btn-close-dark:hover { color: #e2e8f0; }

/* Animazioni */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f1724; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Page title */
.page-title { font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 0.25rem; }
.page-subtitle { color: #64748b; font-size: 0.875rem; margin-bottom: 1.5rem; }

/* Stepper */
.stepper { display: flex; gap: 0; margin-bottom: 2rem; border-radius: 12px; overflow: hidden; }
.step {
    flex: 1;
    text-align: center;
    padding: 1rem;
    background: #1e293b;
    position: relative;
    color: #64748b;
    font-size: 0.85rem;
    transition: all 0.3s;
}
.step.active { background: rgba(59,130,246,0.2); color: #60a5fa; }
.step.completed { background: rgba(34,197,94,0.15); color: #4ade80; }
.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #334155;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s;
}
.step.active .step-number { background: #3b82f6; box-shadow: 0 0 12px rgba(59,130,246,0.5); }
.step.completed .step-number { background: #22c55e; }
.step-content { animation: fadeInUp 0.3s ease; }

/* Blazor error UI */
#blazor-error-ui {
    background: #1e293b;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    color: #f87171;
    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-ui .reload { color: #60a5fa; }

.blazor-error-boundary { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 1rem; color: #f87171; }
.blazor-error-boundary::after { content: "Si è verificato un errore." }

.valid.modified:not([type=checkbox]) { outline: 1px solid #4ade80; border-radius: 4px; }
.invalid { outline: 1px solid #f87171; border-radius: 4px; }
.validation-message { color: #f87171; font-size: 0.8rem; margin-top: 0.25rem; }

/* ===== BOOTSTRAP DARK OVERRIDES ===== */
/* Nasconde elementi Blazor di default */
#blazor-error-ui { display: none !important; }
#components-reconnect-modal { display: none !important; }

/* Modal */
.modal-content { background: #1e293b !important; color: #e2e8f0 !important; border: 1px solid rgba(255,255,255,0.1) !important; }
.modal-header { background: #1e293b !important; border-bottom: 1px solid rgba(255,255,255,0.1) !important; color: #e2e8f0 !important; }
.modal-body { background: #1e293b !important; color: #e2e8f0 !important; }
.modal-footer { background: #1e293b !important; border-top: 1px solid rgba(255,255,255,0.1) !important; }
.modal-title { color: #e2e8f0 !important; }
.btn-close { filter: invert(1) !important; }

/* Dropdown */
.dropdown-menu { background: #1e293b !important; border: 1px solid rgba(255,255,255,0.1) !important; }
.dropdown-item { color: #e2e8f0 !important; }
.dropdown-item:hover, .dropdown-item:focus { background: rgba(59,130,246,0.2) !important; color: #e2e8f0 !important; }

/* Form controls */
.form-control { background: rgba(255,255,255,0.05) !important; border: 1px solid rgba(255,255,255,0.1) !important; color: #e2e8f0 !important; }
.form-control:focus { background: rgba(255,255,255,0.08) !important; border-color: #3b82f6 !important; box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important; color: #e2e8f0 !important; }
.form-select { background-color: rgba(255,255,255,0.05) !important; border: 1px solid rgba(255,255,255,0.1) !important; color: #e2e8f0 !important; }
.form-select:focus { background-color: rgba(255,255,255,0.08) !important; border-color: #3b82f6 !important; box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important; color: #e2e8f0 !important; }
.form-control-color { width: 3rem !important; padding: 0.375rem !important; }
.form-label { color: #94a3b8 !important; }
.form-check-label { color: #e2e8f0 !important; }
.form-text { color: #64748b !important; }
select option { background: #1e293b; color: #e2e8f0; }

/* Alerts */
.alert { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #e2e8f0; }
.alert-danger { background: rgba(239,68,68,0.1) !important; border-color: rgba(239,68,68,0.3) !important; color: #fca5a5 !important; }
.alert-success { background: rgba(34,197,94,0.1) !important; border-color: rgba(34,197,94,0.3) !important; color: #86efac !important; }
.alert-warning { background: rgba(234,179,8,0.1) !important; border-color: rgba(234,179,8,0.3) !important; color: #fde047 !important; }
.alert-info { background: rgba(59,130,246,0.1) !important; border-color: rgba(59,130,246,0.3) !important; color: #93c5fd !important; }

/* Cards */
.card { background: #1e293b !important; border: 1px solid rgba(255,255,255,0.08) !important; color: #e2e8f0 !important; }
.card-header { background: rgba(255,255,255,0.04) !important; border-bottom: 1px solid rgba(255,255,255,0.08) !important; color: #e2e8f0 !important; }
.card-footer { background: rgba(255,255,255,0.04) !important; border-top: 1px solid rgba(255,255,255,0.08) !important; color: #e2e8f0 !important; }
.card-body { color: #e2e8f0 !important; }
.card-title { color: #fff !important; }
.card-subtitle { color: #94a3b8 !important; }
.text-muted { color: #64748b !important; }

/* List group */
.list-group-item { background: #1e293b !important; border-color: rgba(255,255,255,0.08) !important; color: #e2e8f0 !important; }
.list-group-item:hover { background: rgba(59,130,246,0.1) !important; }

/* Table */
.table { color: #e2e8f0 !important; }
.table > :not(caption) > * > * { background-color: transparent !important; color: #e2e8f0 !important; border-color: rgba(255,255,255,0.08) !important; }
.table-hover > tbody > tr:hover > * { background-color: rgba(59,130,246,0.05) !important; }

/* Buttons */
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb) !important; border-color: #2563eb !important; color: #fff !important; }
.btn-primary:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; border-color: #1d4ed8 !important; }
.btn-secondary { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.1) !important; color: #94a3b8 !important; }
.btn-secondary:hover { background: rgba(255,255,255,0.1) !important; color: #e2e8f0 !important; }
.btn-outline-primary { color: #60a5fa !important; border-color: rgba(59,130,246,0.4) !important; background: transparent !important; }
.btn-outline-primary:hover { background: rgba(59,130,246,0.1) !important; color: #60a5fa !important; }
.btn-outline-danger { color: #f87171 !important; border-color: rgba(239,68,68,0.4) !important; background: transparent !important; }
.btn-outline-danger:hover { background: rgba(239,68,68,0.1) !important; color: #f87171 !important; }
.btn-danger { background: rgba(239,68,68,0.15) !important; border-color: rgba(239,68,68,0.3) !important; color: #f87171 !important; }
.btn-danger:hover { background: rgba(239,68,68,0.25) !important; }

/* Input group */
.input-group-text { background: rgba(255,255,255,0.05) !important; border-color: rgba(255,255,255,0.1) !important; color: #94a3b8 !important; }

/* Pagination */
.page-link { background: #1e293b !important; border-color: rgba(255,255,255,0.1) !important; color: #94a3b8 !important; }
.page-link:hover { background: rgba(59,130,246,0.1) !important; color: #60a5fa !important; }
.page-item.active .page-link { background: #3b82f6 !important; border-color: #3b82f6 !important; color: #fff !important; }
.page-item.disabled .page-link { background: #1e293b !important; color: #475569 !important; }

/* Misc */
input[type="color"] { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; }
h1, h2, h3, h4, h5, h6 { color: #e2e8f0; }


/* === Autocomplete Wizard Cliente === */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
}
.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s;
}
.autocomplete-item:hover {
    background: rgba(59,130,246,0.2);
}
.autocomplete-item strong {
    color: #e2e8f0;
    display: block;
}
.autocomplete-item small {
    color: #64748b;
    font-size: 0.8rem;
}
.selected-badge {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(34,197,94,0.15);
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 8px;
    color: #86efac;
    font-size: 0.85rem;
}
