@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ========================================================
   HERESCOPE BACKOFFICE - DESIGN SYSTEM CENTRALIZZATO
   ========================================================
   Tutti gli stili condivisi del progetto sono qui.
   I file .razor.css individuali sono solo per stili
   veramente specifici di un singolo componente.
   ======================================================== */


/* ========================================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ======================================================== */
:root {
    /* Colori primari */
    --h3s-accent: #f42b55;
    --h3s-accent-hover: #d91e45;
    --h3s-accent-active: #c41939;
    --h3s-accent-shadow: rgba(244, 43, 85, 0.25);
    --h3s-accent-glow: rgba(244, 43, 85, 0.2);

    /* Neutri */
    --h3s-black: #000000;
    --h3s-black-hover: #333333;
    --h3s-black-active: #1a1a1a;
    --h3s-white: #ffffff;

    /* Testo */
    --h3s-text-heading: #212529;
    --h3s-text-body: #495057;
    --h3s-text-muted: #6c757d;
    --h3s-text-on-dark: #d7d7d7;
    --h3s-text-on-accent: #ffffff;

    /* Sfondi */
    --h3s-bg-main: #ffffff;
    --h3s-bg-section: #f8f9fa;
    --h3s-bg-hover: #e9ecef;
    --h3s-bg-subtle: rgba(0, 0, 0, 0.03);

    /* Bordi */
    --h3s-border: #dee2e6;
    --h3s-border-light: #e9ecef;
    --h3s-border-focus: #adb5bd;

    /* Raggi */
    --h3s-radius-sm: 4px;
    --h3s-radius-md: 8px;
    --h3s-radius-lg: 12px;
    --h3s-radius-xl: 16px;
    --h3s-radius-pill: 100px;
    --h3s-radius-circle: 50%;

    /* Ombre */
    --h3s-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --h3s-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --h3s-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --h3s-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15);

    /* Transizioni */
    --h3s-transition-fast: 0.2s ease;
    --h3s-transition: 0.3s ease;
    --h3s-transition-slow: 0.5s ease-out;

    /* Colori stato */
    --h3s-success: #28a745;
    --h3s-danger: #dc3545;
    --h3s-warning: #ffc107;
    --h3s-info: #17a2b8;
    --h3s-orange: #fd7e14;

    /* Z-index scale */
    --h3s-z-sticky: 100;
    --h3s-z-dropdown: 500;
    --h3s-z-modal-backdrop: 1000;
    --h3s-z-modal: 1050;
    --h3s-z-toast: 1100;

    /* Radzen series */
    --rz-series-1: #EDEDED !important;
    --rz-series-2: #f42b55 !important;
    --rz-series-3: #000000 !important;
    --rz-white: #ffffff;
}


/* ========================================================
   2. RESET & BASE
   ======================================================== */
html {
    scroll-behavior: smooth;
}

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

/* Selection color */
::selection {
    background: var(--h3s-accent);
    color: var(--h3s-white);
}

/* Scrollbar globale sottile */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--h3s-border, #dee2e6);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--h3s-text-muted, #6c757d);
}

/* Nasconde scrollbar utility */
.h3s-no-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.h3s-no-scrollbar::-webkit-scrollbar {
    display: none;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--h3s-accent);
}

.btn-primary {
    color: var(--h3s-text-on-accent);
    background-color: var(--h3s-accent);
    border-color: var(--h3s-accent);
}

.btn-primary:hover {
    background-color: var(--h3s-accent-hover);
    border-color: var(--h3s-accent-hover);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--h3s-white), 0 0 0 0.25rem var(--h3s-accent);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--h3s-accent);
}

.invalid {
    outline: 1px solid var(--h3s-danger);
}

.validation-message {
    color: var(--h3s-danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    padding-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.validation-message::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--h3s-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Print */
@media print {
    .no-print, .no-print * {
        display: none !important;
    }
}


/* ========================================================
   3. LAYOUT
   ======================================================== */

/* Top bar scura (sostituisce inline style in MainLayout) */
.h3s-topbar {
    background-color: var(--h3s-black);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 75px;
    z-index: var(--h3s-z-sticky);
}

/* Content wrapper senza padding extra */
.h3s-content {
    padding: 0;
}

/* Sticky header per DataGrid Radzen */
.sticky-header .rz-grid-header {
    position: sticky;
    top: 0;
    background: var(--h3s-white);
    z-index: var(--h3s-z-sticky);
}


/* ========================================================
   4. TYPOGRAPHY
   ======================================================== */
.h3s-text-heading {
    font-weight: 600;
    color: var(--h3s-text-heading);
}

.h3s-text-body {
    color: var(--h3s-text-body);
}

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

.h3s-text-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--h3s-text-body);
}


/* ========================================================
   5. BUTTONS
   ======================================================== */

/* --- 5a. Custom button (topbar: logout, download, weblink, utente) --- */
.custom-button,
.logout-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: var(--h3s-white);
    border: 2px solid transparent;
    text-decoration: none;
    transition: all var(--h3s-transition);
    border-radius: var(--h3s-radius-md);
    cursor: pointer;
}

.custom-button:hover,
.logout-link:hover {
    background-color: var(--h3s-accent);
    color: var(--h3s-text-on-accent);
    border-color: var(--h3s-accent);
    text-decoration: none;
}

/* --- 5b. H3S Button (componente riutilizzabile) --- */
.h3s-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border: none;
    transition: all var(--h3s-transition-fast);
    cursor: pointer;
}

.h3s-btn i {
    font-size: 1.2rem;
}

/* H3S Black */
.h3s-btn-black {
    background-color: var(--h3s-black);
    color: var(--h3s-white);
}

.h3s-btn-black:hover {
    background-color: var(--h3s-black-hover);
    color: var(--h3s-white);
}

.h3s-btn-black:focus,
.h3s-btn-black:active {
    background-color: var(--h3s-black-active);
    color: var(--h3s-white);
    box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
}

.h3s-btn-black i {
    color: var(--h3s-white);
}

/* H3S Magenta */
.h3s-btn-magenta {
    background-color: var(--h3s-accent);
    color: var(--h3s-white);
}

.h3s-btn-magenta:hover {
    background-color: var(--h3s-accent-hover);
    color: var(--h3s-white);
}

.h3s-btn-magenta:focus,
.h3s-btn-magenta:active {
    background-color: var(--h3s-accent-active);
    color: var(--h3s-white);
    box-shadow: 0 0 0 0.25rem var(--h3s-accent-shadow);
}

.h3s-btn-magenta i {
    color: var(--h3s-white);
}

/* --- 5c. Circle button (azioni card dipendente/cliente) --- */
.circle-button {
    width: 50px;
    height: 50px;
    border-radius: var(--h3s-radius-circle);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--h3s-transition);
    position: relative;
    font-size: 1.2rem;
    animation: fadeInButton 0.3s ease-out;
}

.circle-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--h3s-shadow-hover);
}

.circle-button.secondary-action {
    background: var(--h3s-danger);
    color: var(--h3s-white);
    border: 2px solid var(--h3s-danger, #c82333);
}

.circle-button.accent-action {
    background: var(--h3s-text-muted);
    color: var(--h3s-white);
    border: 2px solid var(--h3s-border-focus);
}

.button-label {
    font-size: 0.8rem;
    color: var(--h3s-text-muted);
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

/* --- 5d. Button accent utility --- */
.btnprova {
    background-color: var(--h3s-accent) !important;
}

/* --- 5e. Selezione attiva --- */
.btn-selezionato {
    background-color: var(--h3s-black);
    color: var(--h3s-danger);
}


/* ========================================================
   6. CARDS
   ======================================================== */

/* --- 6a. Modern card (dipendente, cliente, etc.) --- */
.modern-card {
    border-radius: var(--h3s-radius-xl) !important;
    border: 2px solid var(--h3s-border) !important;
    background: var(--h3s-white) !important;
    box-shadow: var(--h3s-shadow-md);
    transition: all var(--h3s-transition);
    overflow: hidden;
    animation: fadeInSubtle var(--h3s-transition-slow);
    display: flex;
    flex-direction: column;
}

.modern-card:hover {
    box-shadow: var(--h3s-shadow-hover);
    transform: translateY(-2px);
    border-color: var(--h3s-border-focus);
}

/* Card header con avatar */
.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--h3s-bg-subtle) !important;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--h3s-border);
    position: relative;
}

/* Avatar utente */
.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--h3s-radius-circle);
    background: var(--h3s-text-body);
    color: var(--h3s-white);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 3px solid var(--h3s-white);
    animation: fadeInAvatar 0.4s ease-out;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--h3s-text-body);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-email {
    font-size: 0.9rem;
    color: var(--h3s-text-muted);
}

/* Stats nella card */
.stats-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--h3s-text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 0.9rem;
    color: var(--h3s-text-body);
    font-weight: 600;
}

/* Detail items nelle card */
.compact-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    padding: 1rem 0;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--h3s-radius-md);
    background: var(--h3s-bg-section);
    border: 1px solid var(--h3s-border-light);
    transition: all var(--h3s-transition);
    animation: fadeInDetail 0.3s ease-out;
}

.detail-item:hover {
    background: var(--h3s-bg-hover);
    border-color: var(--h3s-border);
    transform: translateX(4px);
}

.detail-icon {
    color: var(--h3s-text-muted);
    font-size: 1.1rem;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--h3s-text-body);
    font-weight: 500;
}

/* Card container e layout mobile */
.card-container {
    height: 100%;
}

.mobile-card-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    justify-content: space-between;
}

/* Azioni card (barra bottoni in basso) */
.horizontal-button-bar {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 2px solid var(--h3s-border);
    margin-top: auto;
}

.secondary-actions-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.action-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}


/* ========================================================
   7. FORMS
   ======================================================== */

/* Login form inputs (pill-shaped) */
.h3s-login input[type='email'],
.h3s-login input[type='password'] {
    border-radius: var(--h3s-radius-pill);
    border: none;
    background: var(--h3s-bg-section);
}

.h3s-login input[type='button'] {
    border-radius: var(--h3s-radius-pill);
}

.h3s-login .card {
    overflow: hidden;
    border-radius: 10px;
    min-height: 500px;
    border: none;
}

.h3s-login .card-body {
    padding: 2rem;
}

.h3s-login .modal-content {
    background-color: transparent;
    border: none;
}


/* ========================================================
   8. MODALS
   ======================================================== */

/* Backdrop sfocato */
.blur-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: var(--h3s-z-modal-backdrop);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Popup container */
.popup {
    background-color: transparent;
    padding: 20px;
    border-radius: 10px;
}

/* Modal base */
.modal {
    display: none;
}

.modal.show {
    display: block;
}

/* Modern Modal */
.modern-modal {
    border: none;
    border-radius: var(--h3s-radius-xl);
    box-shadow: var(--h3s-shadow-lg);
    overflow: hidden;
}

.modern-modal-header {
    background: linear-gradient(135deg, var(--h3s-bg-section) 0%, var(--h3s-bg-hover) 100%);
    border-bottom: 1px solid var(--h3s-border);
    padding: 1.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.modal-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--h3s-radius-circle);
    background: var(--h3s-accent);
    color: var(--h3s-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.modal-title-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--h3s-text-heading);
}

.modal-subtitle {
    color: var(--h3s-text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* Close button modale */
.modern-close-btn {
    background: var(--h3s-bg-section);
    border: 1px solid var(--h3s-border);
    border-radius: var(--h3s-radius-circle);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--h3s-transition-fast);
    color: var(--h3s-text-muted);
}

.modern-close-btn:hover {
    background: var(--h3s-bg-hover);
    border-color: var(--h3s-border-focus);
    color: var(--h3s-text-body);
    transform: scale(1.05);
}

/* Body e footer modale */
.modern-modal-body {
    padding: 2.5rem;
    overflow-y: auto;
    max-height: calc(75vh - 180px);
    background: var(--h3s-white);
}

.modern-modal-footer {
    background: var(--h3s-bg-section);
    border-top: 1px solid var(--h3s-border);
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1.75rem;
}

/* Save button modale */
.modern-save-btn {
    border-radius: var(--h3s-radius-md);
    padding: 1rem 2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--h3s-transition-fast);
    box-shadow: 0 2px 4px var(--h3s-accent-glow);
    min-width: 120px;
    justify-content: center;
}

.modern-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--h3s-accent-shadow);
}

.btn-icon {
    font-size: 1rem;
}

/* Legacy modal compatibility */
.modal-body {
    overflow-y: auto;
    max-height: calc(75vh - 120px);
}

.close-btn {
    background: transparent;
    border: none;
    padding: 5px;
    position: absolute;
    top: 12px;
    right: 15px;
    cursor: pointer;
    transition: transform var(--h3s-transition-fast);
}

.close-btn svg {
    width: 24px;
    height: 24px;
    transition: transform var(--h3s-transition-fast), filter var(--h3s-transition-fast);
}

.close-btn:hover svg {
    transform: scale(1.1);
    filter: brightness(1.2);
}


/* ========================================================
   9. TABLES
   ======================================================== */

/* Modern table */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--h3s-white);
    border-radius: var(--h3s-radius-lg);
    overflow: hidden;
    box-shadow: var(--h3s-shadow-sm);
}

.modern-table thead th {
    background: linear-gradient(135deg, var(--h3s-bg-section, #fafbfc) 0%, var(--h3s-bg-section, #f8f9fc) 100%);
    color: var(--h3s-text-body);
    font-weight: 600;
    padding: 1rem 0.75rem;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--h3s-border-light);
}

.modern-table tbody tr {
    transition: all var(--h3s-transition-fast);
    border-bottom: 1px solid var(--h3s-border-light, #f1f3f8);
}

.modern-table tbody tr:hover {
    background: var(--h3s-bg-section, #f8f9fc);
}

.modern-table tbody tr:last-child {
    border-bottom: none;
}

.modern-table td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
}

/* Custom table (AddOn, etc.) */
.table-custom {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.table-custom thead {
    background-color: var(--h3s-text-body, #4a4a4a);
    color: var(--h3s-white);
}

.table-custom th, .table-custom td {
    padding: 15px;
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background-color: var(--h3s-bg-section, #f5f5f5);
    transition: background-color var(--h3s-transition);
}

/* Badge */
.badge-custom {
    font-size: 0.8em;
    padding: 5px 10px;
    border-radius: 20px;
}

/* Type badge (spese) */
.type-badge {
    color: var(--h3s-white);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge-percentage {
    background: var(--h3s-info, #3f51b5);
}

.type-badge-fixed {
    background: var(--h3s-success);
}

/* Table cells specifiche */
.spesa-nome-cell {
    font-weight: 600;
    color: var(--h3s-text-body);
}

.spesa-descrizione-cell {
    color: var(--h3s-text-muted);
    font-size: 0.875rem;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.value-cell {
    font-weight: 600;
}

.spesa-value {
    color: var(--h3s-text-heading);
    font-size: 1rem;
}

/* Action buttons in tabelle */
.action-buttons {
    display: flex;
    gap: 0.25rem;
}

.action-buttons .btn {
    border-radius: 6px;
    padding: 0.375rem 0.5rem;
    transition: all var(--h3s-transition-fast);
}

.action-buttons .btn:hover {
    transform: translateY(-1px);
}

.table-actions {
    display: flex;
    justify-content: flex-end;
}


/* ========================================================
   10. LOADING & EMPTY STATES
   ======================================================== */

/* Loading state standard */
.h3s-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    padding: 2rem;
}

.h3s-loading .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--h3s-black);
    margin-bottom: 1rem;
}

.h3s-loading-text {
    color: var(--h3s-text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* Loading overlay (per componenti) */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    z-index: var(--h3s-z-modal-backdrop);
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    border: 4px solid var(--h3s-border-light);
    border-radius: var(--h3s-radius-circle);
    border-top: 4px solid var(--h3s-accent);
    width: 40px;
    height: 40px;
    animation: h3s-spin 0.8s linear infinite;
}

/* Loading state (pattern SpeseExtra) */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
}

.loading-state .spinner-border {
    width: 2rem;
    height: 2rem;
    margin-bottom: 1rem;
}

/* Empty state standard */
.h3s-empty-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--h3s-bg-section);
    border: 2px dashed var(--h3s-border-light);
    border-radius: var(--h3s-radius-lg);
    min-height: 200px;
}

.h3s-empty-state .material-icons,
.empty-state .material-icons {
    font-size: 4rem;
    color: var(--h3s-text-muted);
    margin-bottom: 1rem;
    opacity: 0.6;
}

.h3s-empty-state h4,
.empty-state h4 {
    color: var(--h3s-text-body);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.h3s-empty-state p,
.empty-state p {
    color: var(--h3s-text-muted);
    font-size: 0.9rem;
    margin: 0 0 1rem 0;
    max-width: 400px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    background: var(--h3s-bg-hover);
    color: var(--h3s-text-muted);
    border-radius: var(--h3s-radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.empty-message {
    color: var(--h3s-text-muted);
    font-size: 0.9rem;
    margin: 0 0 1rem 0;
}


/* ========================================================
   11. PAGE HEADERS
   ======================================================== */
.h3s-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 2px solid var(--h3s-black);
    margin-bottom: 1.5rem;
}

.h3s-page-header h2 {
    margin: 0;
    font-weight: 700;
    color: var(--h3s-text-heading);
    font-size: 1.5rem;
}

.h3s-page-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Page wrapper */
.h3s-page {
    padding: 1.5rem;
    min-height: calc(100vh - 75px);
    background: var(--h3s-white);
}


/* ========================================================
   12. APPUNTAMENTI (calendario)
   ======================================================== */
.pallina::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--h3s-danger);
    border-radius: var(--h3s-radius-circle);
    margin-right: 8px;
    vertical-align: middle;
}

.dialog-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    position: absolute;
    top: 0;
    left: 0;
}


/* ========================================================
   13. CAROUSEL (planimetrie)
   ======================================================== */
.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 1;
    z-index: 1;
    background: none;
    border: none;
}

.carousel-prev-icon,
.carousel-next-icon {
    filter: invert(1);
    width: 2rem;
    height: 2rem;
}


/* ========================================================
   14. STAT CARD
   ======================================================== */
.stat-card .data-display {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: 1.5rem;
}

.stat-card .icon {
    font-size: 2rem;
    color: var(--h3s-text-muted);
}

.stat-card .title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--h3s-text-body);
}

.stat-card .sub-title {
    font-size: 0.8rem;
    color: var(--h3s-text-muted);
}


/* ========================================================
   15. RADZEN OVERRIDES
   ======================================================== */

/* Radzen success button -> accent */
.rz-button.rz-success {
    background-color: var(--h3s-accent) !important;
    border-color: var(--h3s-accent) !important;
}

.rz-button.rz-success:hover {
    background-color: var(--h3s-accent-hover) !important;
}

/* Radzen card global */
.rz-card {
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* Radzen datagrid global */
.rz-datagrid {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}


/* ========================================================
   16. 404 PAGE
   ======================================================== */
.h3s-404 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.h3s-404 .material-icons {
    font-size: 6rem;
    color: var(--h3s-text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.h3s-404 h2 {
    font-weight: 700;
    color: var(--h3s-text-heading);
    margin-bottom: 0.5rem;
}

.h3s-404 p {
    color: var(--h3s-text-muted);
    font-size: 1rem;
}


/* ========================================================
   17. ANIMATIONS
   ======================================================== */
@keyframes fadeInSubtle {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeInButton {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes fadeInAvatar {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes h3s-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ========================================================
   18. GLOBAL POLISH - Cards, Tables, Buttons, Utilities
   ======================================================== */

/* Global card styling */
.card {
    border-radius: var(--h3s-radius-lg, 12px);
    box-shadow: var(--h3s-shadow-sm);
    border: 1px solid var(--h3s-border, #dee2e6);
    transition: box-shadow var(--h3s-transition-fast), transform var(--h3s-transition-fast);
}

.card:hover {
    box-shadow: var(--h3s-shadow-md);
}

/* Global table improvements */
table {
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.85rem;
}

table tbody tr {
    transition: background-color var(--h3s-transition-fast);
}

table tbody tr:hover {
    background-color: var(--h3s-bg-section, #f8f9fa);
}

/* Better global .btn base styling */
.btn {
    transition: all var(--h3s-transition-fast);
    border-radius: var(--h3s-radius-md, 8px);
}

.btn:focus-visible {
    outline: 2px solid var(--h3s-accent, #f42b55);
    outline-offset: 2px;
    box-shadow: none;
}

/* Scrollbar hiding utility */
.h3s-no-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.h3s-no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Content area padding */
.content {
    padding: 1rem 1.5rem;
}


/* ========================================================
   19. RESPONSIVE / MOBILE
   ======================================================== */
@media (max-width: 576px) {
    /* Modals */
    .modal-dialog {
        max-width: 95%;
        margin: auto;
    }

    .modern-modal-header {
        padding: 1.25rem 1.5rem;
    }

    .modern-modal-body {
        padding: 1.5rem;
    }

    .modern-modal-footer {
        padding: 1.75rem 1.5rem;
        flex-direction: column;
        gap: 1.25rem;
    }

    .modal-header-content {
        gap: 0.75rem;
    }

    .modal-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .close-btn {
        top: 10px;
        right: 12px;
    }

    .close-btn svg {
        width: 28px;
        height: 28px;
    }

    .modern-close-btn {
        width: 36px;
        height: 36px;
    }

    /* Tables */
    .modern-table {
        font-size: 0.8rem;
    }

    .modern-table thead th,
    .modern-table td {
        padding: 0.5rem 0.375rem;
    }

    .spesa-descrizione-cell {
        max-width: 120px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.125rem;
    }

    .action-buttons .btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }

    /* Cards */
    .compact-details {
        grid-template-columns: 1fr;
    }

    .secondary-actions-group {
        gap: 0.5rem;
    }

    .circle-button {
        width: 45px;
        height: 45px;
    }

    .stats-info {
        display: none;
    }

    /* Page headers */
    .h3s-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

@media (max-width: 576px) {
    .modern-table thead th:nth-child(2),
    .modern-table td:nth-child(2) {
        display: none;
    }
}

@media (max-width: 768px) {
    .modern-table {
        font-size: 0.8rem;
    }

    .modern-table thead th,
    .modern-table td {
        padding: 0.5rem 0.375rem;
    }
}


/* ========================================================
   20. RADZEN MOBILE OVERRIDES
   ======================================================== */

/* Radzen DataGrid - mobile friendly */
@media (max-width: 768px) {
    .rz-datatable {
        font-size: 0.8rem;
    }

    .rz-datatable .rz-datatable-thead th {
        font-size: 0.72rem;
        padding: 0.4rem 0.3rem;
        white-space: nowrap;
    }

    .rz-datatable .rz-datatable-data td {
        padding: 0.35rem 0.3rem;
        font-size: 0.8rem;
    }

    .rz-pager {
        flex-wrap: wrap;
        gap: 0.2rem;
        padding: 0.4rem;
        justify-content: center;
    }

    .rz-pager .rz-paginator-page,
    .rz-pager .rz-paginator-element {
        min-width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    /* Radzen Dropdown - prevent overflow */
    .rz-dropdown {
        max-width: 100% !important;
    }

    .rz-dropdown-panel {
        max-width: 90vw !important;
    }

    /* Radzen Dialog/Modal - fit viewport */
    .rz-dialog {
        max-width: 95vw !important;
        margin: 0.5rem auto !important;
    }

    .rz-dialog-content {
        padding: 1rem !important;
    }

    .rz-dialog-titlebar {
        padding: 0.75rem 1rem !important;
    }

    /* Radzen Buttons - touch friendly */
    .rz-button {
        min-height: 40px;
        touch-action: manipulation;
    }

    /* Radzen TextBox/inputs - proper sizing */
    .rz-textbox {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Radzen Card compact */
    .rz-card {
        border-radius: var(--h3s-radius-lg, 12px);
    }

    /* Radzen Scheduler - compact */
    .rz-scheduler {
        font-size: 0.8rem;
    }

    .rz-scheduler .rz-event {
        font-size: 0.7rem;
        padding: 0.15rem 0.25rem;
    }

    /* Radzen HtmlEditor - compact toolbar */
    .rz-html-editor-toolbar {
        flex-wrap: wrap;
        gap: 0.1rem;
    }

    .rz-html-editor-toolbar button {
        padding: 0.2rem;
        min-width: 28px;
        min-height: 28px;
    }
}

@media (max-width: 480px) {
    .rz-datatable {
        font-size: 0.72rem;
    }

    .rz-datatable .rz-datatable-thead th {
        font-size: 0.65rem;
        padding: 0.3rem 0.2rem;
    }

    .rz-datatable .rz-datatable-data td {
        padding: 0.25rem 0.2rem;
    }

    .rz-pager .rz-paginator-info {
        display: none;
    }

    /* Radzen inputs - prevent iOS zoom */
    .rz-textbox,
    .rz-dropdown .rz-inputtext,
    .rz-calendar input {
        font-size: 16px !important;
    }
}

/* ========================================================
   21. GLOBAL MOBILE UTILITIES
   ======================================================== */

/* Touch-friendly interactive elements */
@media (max-width: 768px) {
    /* All clickable elements - minimum touch target */
    button, a.btn, .btn, [role="button"] {
        touch-action: manipulation;
    }

    /* Form inputs - prevent iOS zoom */
    input, select, textarea {
        font-size: 16px;
    }

    /* Container fluid - reduce padding on mobile */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Cards - reduce padding on mobile */
    .card-body {
        padding: 0.75rem;
    }

    /* Modal - always fit viewport */
    .modal-dialog {
        max-width: 95vw;
        margin: 0.5rem auto;
    }

    .modal-content {
        border-radius: var(--h3s-radius-lg, 12px);
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header, .modal-footer {
        padding: 0.75rem 1rem;
    }

    /* Page header responsive */
    .h3s-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.75rem 0;
    }

    .h3s-page-header h2 {
        font-size: 1.25rem;
    }

    .h3s-page-header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Table responsive - hide scrollbar */
    .table-responsive {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .table-responsive::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 480px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card-body {
        padding: 0.5rem;
    }

    .h3s-page-header h2 {
        font-size: 1.1rem;
    }
}


/* ========================================================
   22. 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: var(--h3s-z-toast);
}

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

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}
