:root {
    /* Ocean Blue Primary Palette */
    --ocean-50: #f0f9ff;
    --ocean-100: #e0f2fe;
    --ocean-200: #bae6fd;
    --ocean-300: #7dd3fc;
    --ocean-400: #38bdf8;
    --ocean-500: #0ea5e9;
    --ocean-600: #0284c7;
    --ocean-700: #0369a1;
    --ocean-800: #075985;
    --ocean-900: #0c4a6e;

    /* Cyan/Teal Accents */
    --cyan-50: #ecfeff;
    --cyan-100: #cffafe;
    --cyan-200: #a5f3fc;
    --cyan-300: #67e8f9;
    --cyan-400: #22d3ee;
    --cyan-500: #06b6d4;
    --cyan-600: #0891b2;

    /* Sand/Beach Neutrals */
    --sand-50: #fefce8;
    --sand-100: #fef9c3;
    --sand-200: #fef08a;
    --sand-300: #fde047;

    /* Semantic Colors - Updated for Ocean theme */
    --primary-color: var(--ocean-500);
    --primary-hover: var(--ocean-600);
    --primary-light: var(--ocean-100);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: var(--cyan-500);

    /* Flat Design System */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Sidebar Colors */
    --sidebar-bg: var(--ocean-800);
    --sidebar-hover: var(--ocean-700);
    --sidebar-active: var(--ocean-500);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing Scale */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius - Flat Design */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Bottom Navigation (Mobile) */
    --bottom-nav-height: 64px;
    --bottom-nav-bg: #ffffff;
    --bottom-nav-border: var(--border-color);
    --bottom-nav-active: var(--ocean-500);
}

/* Reset body scroll */
body {
    background-color: var(--bg-primary);
    overflow-x: hidden;
    font-family: var(--font-family);
    color: var(--text-primary);
}

/*
body.app-visible {
    padding-top: 60px;
}
*/

/* Login Section */
/* Login Section - Ottimizzazioni Mobile */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem; /* Aggiungi padding per evitare che tocchi i bordi */
}

.login-card {
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.login-header {
    background: linear-gradient(135deg, var(--ocean-500) 0%, var(--ocean-700) 100%);
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-header i {
    color: var(--cyan-200);
}

/* Mobile specific optimizations */
@media (max-width: 768px) {
    .login-container {
        /* Usa la viewport height dinamica se disponibile, altrimenti fallback a 100vh */
        min-height: 100dvh;
        min-height: 100vh;
        
        /* Aggiusta il comportamento per mobile */
        align-items: flex-start;
        padding: 2rem 1rem 1rem 1rem;
        
        /* Assicurati che non ci sia overflow */
        overflow-y: auto;
        box-sizing: border-box;
    }
    
    .login-card {
        /* Su mobile, centra la card verticalmente con margin auto */
        margin: auto 0;
        max-width: 100%;
        
        /* Assicurati che la card non sia troppo alta */
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
    }
    
    .login-header {
        padding: 20px 15px; /* Riduci il padding su mobile */
    }
    
    .login-header h2 {
        font-size: 1.5rem; /* Riduci la dimensione del titolo */
        margin-bottom: 0.5rem;
    }
    
    .login-header .fa-umbrella-beach {
        font-size: 2.5rem !important; /* Riduci l'icona */
        margin-bottom: 1rem !important;
    }
    
    .login-card .card-body {
        padding: 1.5rem; /* Riduci il padding del body */
    }
    
    /* Ottimizza i form controls per mobile */
    .login-card .form-control {
        font-size: 16px; /* Previene lo zoom su iOS */
        padding: 0.75rem;
    }
    
    .login-card .btn {
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* Per dispositivi molto piccoli (iPhone SE, etc.) */
@media (max-width: 480px) {
    .login-container {
        padding: 1rem 0.5rem;
    }
    
    .login-header {
        padding: 15px 10px;
    }
    
    .login-header .fa-umbrella-beach {
        font-size: 2rem !important;
    }
    
    .login-header h2 {
        font-size: 1.25rem;
    }
    
    .login-card .card-body {
        padding: 1rem;
    }
}

/* Landscape orientation su mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .login-container {
        align-items: flex-start;
        padding: 1rem;
    }
    
    .login-card {
        margin: 0;
    }
    
    .login-header {
        padding: 15px;
    }
    
    .login-header .fa-umbrella-beach {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .login-header h2 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    
    .login-header p {
        font-size: 0.875rem;
        margin-bottom: 0;
    }
}

/* Fix per la viewport height dinamica su browser moderni */
@supports (height: 100dvh) {
    .login-container {
        min-height: 100dvh;
    }
    
    @media (max-width: 768px) {
        .login-card {
            max-height: calc(100dvh - 4rem);
        }
    }
}

/* Assicurati che il body non abbia scroll durante il login */
body:has(.login-container:not([style*="display: none"])) {
    overflow: hidden;
}

/* Fallback per browser che non supportano :has() */
.login-visible {
    overflow: hidden !important;
}

/* Miglioramenti per l'accessibilità touch */
@media (pointer: coarse) {
    .login-card .form-control,
    .login-card .btn {
        min-height: 44px; /* Dimensione minima per touch target */
    }
}

/* Layout adjustment for full-height sidebar */
#appSection {
    position: relative;
    min-height: 100vh;
}

/* ========================================
   NAVBAR - FLAT DESIGN
   ======================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    z-index: 999;
    height: 60px;
    background: linear-gradient(90deg, var(--ocean-600) 0%, var(--ocean-700) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: left;
}

/* When sidebar is collapsed */
.sidebar.collapsed ~ .navbar {
    left: 0 !important;
}

.navbar-brand i {
    color: var(--cyan-200);
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.navbar .dropdown-toggle::after {
    display: none;
}

.navbar .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
}

.navbar .dropdown-item {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    font-weight: 450;
    transition: all 0.2s ease;
}

.navbar .dropdown-item:hover {
    background: var(--ocean-50);
    color: var(--primary-color);
}

.navbar .dropdown-item i {
    width: 20px;
    margin-right: var(--spacing-sm);
}

/* Navbar user dropdown - perfect alignment */
.navbar .navbar-nav {
    align-items: center;
}

.navbar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
    padding: 0.5rem 1rem;
}

.navbar .nav-link i {
    font-size: 1rem;
}

.navbar .dropdown {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Fix navbar layout e dropdown */
.navbar .container-fluid {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar .navbar-nav {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar .dropdown {
    position: relative;
}

/* Fix specifico per il dropdown menu */
.navbar .dropdown-menu {
    position: absolute !important;
    transform: none !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    margin-top: 0.25rem;
}

/* Override Bootstrap Popper static positioning */
.navbar .dropdown-menu[data-bs-popper="static"] {
    position: absolute !important;
    transform: none !important;
}

/* Mobile specific fixes */
@media (max-width: 768px) {
    /* Mantieni il layout fisso della navbar */
    .navbar .container-fluid {
        flex-wrap: nowrap;
    }
    
    /* Assicura che il dropdown non sposti gli elementi */
    .navbar .dropdown {
        position: relative !important;
    }
    
    .navbar .dropdown-menu,
    .navbar .dropdown-menu[data-bs-popper="static"] {
        position: absolute !important;
        top: calc(100% + 0.25rem) !important;
        right: 0 !important;
        left: auto !important;
        transform: none !important;
        min-width: 150px;
        margin: 0;
    }
    
    /* Previeni il resize degli elementi */
    .navbar .nav-link {
        white-space: nowrap;
    }
    
    #sidebarToggle {
        flex-shrink: 0;
        margin-right: 0.5rem !important;
    }
}

/* ========================================
   SIDEBAR - DESKTOP (Modern Flat Design)
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, var(--ocean-800) 0%, var(--ocean-900) 100%);
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed {
    transform: translateX(-260px);
}

/* Sidebar Header */
.sidebar-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h5 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sidebar-header h5 i {
    color: var(--cyan-300);
}

.sidebar-header a {
    color: white;
    text-decoration: none;
}

/* Sidebar close button - solo mobile */
.sidebar-close {
    display: none;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    transition: color 0.2s ease;
}

.sidebar-close:hover {
    color: #fff;
}

/* Sidebar Navigation */
.sidebar .nav {
    padding: var(--spacing-md) 0;
}

.sidebar .nav-item {
    margin: 2px var(--spacing-sm);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    font-weight: 450;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--sidebar-active);
    font-weight: 500;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.9;
}

.sidebar .nav-link.active i {
    opacity: 1;
}

/* Sidebar Divider */
.sidebar hr {
    border-color: rgba(255, 255, 255, 0.15);
    margin: var(--spacing-md) var(--spacing-lg);
}

/* Main content */
.main-content {
    margin-left: 260px;
    padding: 80px var(--spacing-xl) var(--spacing-xl) var(--spacing-xl);
    min-height: 100vh;
    background: var(--bg-primary);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: margin-left;
}

.main-content.expanded {
    margin-left: 0;
}

/* ========================================
   CARDS - FLAT DESIGN
   ======================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: none;
    transition: border-color 0.2s ease;
    overflow: hidden;
}

.card:hover {
    border-color: var(--ocean-300);
    box-shadow: none;
    transform: none;
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stat Cards - Compact design */
.stat-card {
    border-left: 3px solid;
    border-radius: var(--radius-md);
}

.stat-card.primary {
    border-left-color: var(--primary-color);
    background: linear-gradient(to right, var(--ocean-50) 0%, var(--bg-card) 100%);
}

.stat-card.success {
    border-left-color: var(--success-color);
    background: linear-gradient(to right, #ecfdf5 0%, var(--bg-card) 100%);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
    background: linear-gradient(to right, #fffbeb 0%, var(--bg-card) 100%);
}

.stat-card.info {
    border-left-color: var(--info-color);
    background: linear-gradient(to right, var(--cyan-50) 0%, var(--bg-card) 100%);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
    background: linear-gradient(to right, #fef2f2 0%, var(--bg-card) 100%);
}

.stat-card .card-body {
    padding: 1rem;
    position: relative;
}

.stat-card .stat-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.25rem;
    opacity: 0.5;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Stat Cards Row - compact layout */
.stat-cards-row {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
    margin-bottom: 1rem;
}

/* Remove extra margin from stat-cards */
.stat-cards-row .stat-card {
    margin-bottom: 0 !important;
}

/* Stat Cards - Mobile compact */
@media (max-width: 767.98px) {
    .stat-cards-row {
        --bs-gutter-x: 0.25rem;
        --bs-gutter-y: 0.25rem;
        margin-bottom: 0.5rem;
    }

    .stat-cards-row > [class*="col"] {
        padding-left: calc(var(--bs-gutter-x) * 0.5);
        padding-right: calc(var(--bs-gutter-x) * 0.5);
    }

    .stat-card {
        height: auto !important;
    }

    .stat-card .card-body {
        padding: 0.35rem 0.4rem;
    }

    .stat-card .stat-icon {
        top: 0.2rem;
        right: 0.3rem;
        font-size: 0.8rem;
    }

    .stat-card .stat-label {
        font-size: 0.55rem;
        margin-bottom: 0;
    }

    .stat-card .stat-value {
        font-size: 0.9rem;
        font-weight: 700;
    }
}

/* ========================================
   BADGES - FLAT DESIGN
   ======================================== */

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}

.badge i {
    line-height: 1;
    font-size: 0.6875rem;
}

/* Client Type Badges */
.badge-tipo-fisico {
    background-color: #8b5cf6;
    color: white;
}

.badge-tipo-azienda {
    background-color: #f97316;
    color: white;
}

/* Service Category Badges */
.badge-categoria-spiaggia {
    background-color: var(--cyan-500);
    color: white;
}

.badge-categoria-bar {
    background-color: #f97316;
    color: white;
}

.badge-categoria-servizi {
    background-color: #8b5cf6;
    color: white;
}

.badge-categoria-altro {
    background-color: var(--secondary-color);
    color: white;
}

/* Status Badges */
.badge-stato-attiva {
    background-color: var(--success-color);
    color: white;
}

.badge-stato-completata {
    background-color: var(--primary-color);
    color: white;
}

.badge-stato-annullata {
    background-color: var(--danger-color);
    color: white;
}

/* Loading overlay */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading.show {
    display: flex;
}

.loading.initial-load {
    display: flex;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1055;
}

.toast-container .toast {
    margin-bottom: 0.75rem;
}

.toast-container .toast:last-child {
    margin-bottom: 0;
}

/* ========================================
   MODALS - FLAT DESIGN
   ======================================== */

.modal-content {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.modal-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-lg);
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
}

.btn-close {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
}

/* ===================
   Modal Beach Standard
   =================== */

/* Header unificato con gradient ocean */
.modal-header-beach {
    background: linear-gradient(135deg, var(--ocean-600) 0%, var(--ocean-700) 100%);
    border-bottom: none;
    padding: 0.625rem 1rem;
}

.modal-header-beach .modal-title {
    color: #fff !important;
    font-size: 0.9375rem;
    font-weight: 500;
}

.modal-header-beach .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.modal-header-beach .btn-close:hover {
    opacity: 1;
}

/* Footer unificato */
.modal-footer-beach {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
    background: var(--bg-primary);
}

/* Content unificato */
.modal-content-beach {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    overflow: hidden;
}

/* Mobile fullscreen per modal grandi */
@media (max-width: 575.98px) {
    .modal-fullscreen-sm-down .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    .modal-fullscreen-sm-down .modal-content-beach {
        border-radius: 0;
        min-height: 100vh;
    }

    .modal-fullscreen-sm-down .modal-header-beach {
        border-radius: 0;
    }

    .modal-fullscreen-sm-down .modal-footer-beach {
        position: sticky;
        bottom: 0;
        background: white;
        box-shadow: 0 -2px 10px rgb(0 0 0 / 0.1);
    }
}

/* Nav Tabs in Modals */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 0;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: var(--ocean-300);
    color: var(--text-primary);
    background: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .modal-dialog {
        margin: var(--spacing-sm);
        max-height: calc(100vh - 1rem);
    }

    .modal-content {
        border-radius: var(--radius-lg);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--spacing-md);
    }

    /* Full-screen modal on mobile for large modals */
    .modal-xl .modal-dialog,
    .modal-lg .modal-dialog {
        margin: 0;
        height: 100%;
        max-width: 100%;
    }

    .modal-xl .modal-content,
    .modal-lg .modal-content {
        height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-xl .modal-body,
    .modal-lg .modal-body {
        flex: 1;
        overflow-y: auto;
    }
}

.required::after {
    content: " *";
    color: var(--danger-color);
}

/* ========================================
   TABLES - MODERN FLAT DESIGN
   ======================================== */

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--spacing-md);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--ocean-50);
}

.table tbody td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-primary);
    font-size: 1rem;
}

/* DataTables customization */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: var(--spacing-md);
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    width: auto;
    display: inline-block;
    font-size: 1rem;
    height: 38px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    display: inline-block;
    width: auto;
    margin-left: 0.5em;
    font-size: 1rem;
}

.dataTables_wrapper .dataTables_info {
    color: var(--text-secondary);
    font-size: 1rem;
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: var(--spacing-md);
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Reset pagination container */
.dataTables_wrapper .dataTables_paginate .pagination,
.dataTables_wrapper .dataTables_paginate > span {
    margin: 0;
    padding: 0;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    display: inline-flex;
}

/* Page links - Bootstrap style */
.dataTables_wrapper .dataTables_paginate .page-link {
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    color: var(--primary-color);
    background-color: #fff;
    border: 1px solid var(--border-color);
    margin-left: -1px;
}

.dataTables_wrapper .dataTables_paginate .page-item:first-child .page-link {
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    margin-left: 0;
}

.dataTables_wrapper .dataTables_paginate .page-item:last-child .page-link {
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    z-index: 1;
}

.dataTables_wrapper .dataTables_paginate .page-link:hover {
    background-color: var(--ocean-50);
    border-color: var(--border-color);
    color: var(--primary-color);
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    color: var(--text-muted);
    background-color: #fff;
}

table.dataTable tbody tr:hover {
    background-color: var(--ocean-50);
}

/* Table action buttons - uniform style 32x32 */
table .btn-sm,
table .btn-group-sm .btn,
table.dataTable .btn-group-sm .btn {
    padding: 0 !important;
    font-size: 0.8125rem;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    max-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* btn-group border-radius - solo primo e ultimo */
table .btn-group-sm .btn,
table.dataTable .btn-group-sm .btn {
    border-radius: 0;
}

table .btn-group-sm .btn:first-child,
table.dataTable .btn-group-sm .btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

table .btn-group-sm .btn:last-child,
table.dataTable .btn-group-sm .btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Pulsante singolo (non in gruppo) */
table .btn-sm:not(.btn-group-sm .btn) {
    border-radius: 6px;
}

table .btn-sm i,
table .btn-group-sm .btn i,
table.dataTable .btn-group-sm .btn i {
    font-size: 0.75rem;
}

/* Action cell - center buttons vertically */
table.dataTable td .btn-group,
table.dataTable td .btn-group-sm {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* No hover movement on table action buttons */
.dataTables_wrapper .btn:hover,
.dataTables_wrapper .btn:active,
.dataTables_wrapper .btn:focus,
table .btn:hover,
table .btn:active,
table .btn:focus,
td .btn:hover,
td .btn:active,
td .btn:focus {
    transform: none !important;
}

.dataTables_wrapper .btn-primary:hover,
table .btn-primary:hover,
td .btn-primary:hover {
    background: #0b76c9;
}

.dataTables_wrapper .btn-danger:hover,
table .btn-danger:hover,
td .btn-danger:hover {
    background: #c92a2a;
}

/* Mobile Table Adjustments */
@media (max-width: 768px) {
    .table thead th,
    .table tbody td {
        padding: var(--spacing-sm);
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: center;
        margin-bottom: var(--spacing-sm);
    }
}

/* ========================================
   FILTER ROW STYLING
   ======================================== */

/* Category filter button group (Servizi page) */
#categoryFilter {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

#categoryFilter .btn {
    flex: 1 1 auto;
    min-width: 100px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#categoryFilter .btn i {
    line-height: 1;
    vertical-align: middle;
}

/* No hover movement on filter tabs */
#categoryFilter .btn:hover,
#categoryFilter .btn:active,
#categoryFilter .btn:focus,
.btn-group .btn:hover,
.btn-group .btn:active,
.btn-group .btn:focus {
    transform: none !important;
}

@media (max-width: 768px) {
    #categoryFilter {
        flex-wrap: wrap;
    }

    #categoryFilter .btn {
        flex: 1 1 calc(50% - 1px);
        min-width: auto;
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    #categoryFilter .btn:nth-child(1),
    #categoryFilter .btn:nth-child(2) {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    #categoryFilter .btn:nth-last-child(1),
    #categoryFilter .btn:nth-last-child(2) {
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
}

@media (max-width: 480px) {
    #categoryFilter .btn {
        flex: 1 1 100%;
        border-radius: 0 !important;
    }

    #categoryFilter .btn:first-child {
        border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    }

    #categoryFilter .btn:last-child {
        border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
    }
}

/* Uniform height for filter controls */
.card-body .row .form-control,
.card-body .row .form-select,
.card-body .row .btn,
.filter-row .form-control,
.filter-row .form-select,
.filter-row .btn {
    height: 38px;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
    font-size: 0.875rem;
}

/* Select2 in filters - match height */
.card-body .select2-container--bootstrap-5 .select2-selection,
.filter-row .select2-container--bootstrap-5 .select2-selection {
    min-height: 38px !important;
    height: 38px !important;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.card-body .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered,
.filter-row .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 24px;
}

/* Date inputs in filters */
.card-body input[type="date"],
.filter-row input[type="date"] {
    height: 38px;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

/* Filter buttons alignment */
.card-body .row .btn-primary,
.card-body .row .btn-secondary,
.filter-row .btn {
    min-width: 38px;
}

/* Mobile filter optimization */
@media (max-width: 768px) {
    .card-body .row .form-control,
    .card-body .row .form-select,
    .card-body .row .btn,
    .filter-row .form-control,
    .filter-row .form-select,
    .filter-row .btn {
        height: 42px;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .card-body .row > [class*="col-"],
    .filter-row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }

    .card-body .select2-container--bootstrap-5 .select2-selection,
    .filter-row .select2-container--bootstrap-5 .select2-selection {
        min-height: 42px !important;
        height: 42px !important;
    }
}

/* Mobile filter button height consistency */
.mobile-filter-btn {
    height: 31px;
    min-width: 31px;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .mobile-filter-btn {
        height: 38px;
        min-width: 38px;
    }
}

/* ========================================
   TABLE CONTENT STYLING
   ======================================== */

/* Uniform table cell font size */
table.dataTable tbody td {
    font-size: 1rem;
    vertical-align: middle;
}

table.dataTable thead th {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--text-secondary);
}

/* Price columns - uniform font */
.servizio-price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--success-color);
}

table.dataTable td .fw-bold {
    font-size: 1rem;
}

table.dataTable td .text-success,
table.dataTable td .text-danger {
    font-size: 1rem;
}

/* Badge sizing in tables */
table.dataTable .badge {
    font-size: 0.8125rem;
    padding: 0.4em 0.7em;
    font-weight: 500;
}

/* Clickable elements in tables */
.clickable-row,
.clickable-link {
    cursor: pointer;
    color: var(--primary-color);
    text-decoration: none;
}

.clickable-row:hover,
.clickable-link:hover {
    text-decoration: underline;
    color: #0a58ca;
}

/* Prevent accidental link navigation */
a[onclick] {
    cursor: pointer;
}

/* Table action buttons */
.btn-group-sm > .btn {
    padding: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.8125rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Select2 customization */
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid #ced4da;
    min-height: calc(1.5em + 0.75rem + 2px);
}

.select2-container--bootstrap-5 .select2-selection--single {
    padding: 0.375rem 0.75rem;
}

/* Fix Select2 z-index in modals */
.modal .select2-container {
    z-index: 1056;
}

.select2-container--bootstrap-5 .select2-dropdown {
    z-index: 1056;
}

/* Fix Select2 width responsive */
.select2-container {
    width: 100% !important;
}

/* Specifico per i filtri movimenti */
#filterCliente + .select2-container,
#filterClienteMobile + .select2-container {
    width: 100% !important;
}

/* Servizio form styles */
.servizio-row {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
}

.servizio-row:hover {
    background-color: #e9ecef;
}

.remove-servizio {
    margin-top: 0;
}

/* Prenotazione summary */
.prenotazione-summary {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
}

.prenotazione-timeline {
    border-left: 3px solid #dee2e6;
    padding-left: 1rem;
    margin-left: 1rem;
}

.prenotazione-timeline .timeline-item {
    position: relative;
    padding-bottom: 1rem;
}

.prenotazione-timeline .timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #6c757d;
}

.prenotazione-timeline .timeline-item.entrata::before {
    background-color: #198754;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-250px);
        z-index: 1040;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .navbar {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    /* Mobile overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.5);
        z-index: 1039;
        transition: opacity 0.3s ease;
        opacity: 0;
    }
    
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
    
    /*
    .navbar .container-fluid {
        padding: 0.5rem 1rem;
    }
    */
    
    .navbar .navbar-nav {
        position: static !important;
    }
    
    .navbar .dropdown-menu {
        position: absolute !important;
        right: 0;
        top: 100%;
        margin-top: 0.5rem;
    }
    
    /* Mantieni gli elementi allineati quando il dropdown è aperto */
    .navbar .dropdown.show {
        position: static;
    }
    
    /* Riduci la dimensione del testo su mobile per più spazio */
    #userNameDisplay {
        font-size: 0.9rem;
    }
    
    /* Assicurati che il toggle button rimanga fisso */
    #sidebarToggle {
        flex-shrink: 0;
    }
    
    /* Servizi mobile adjustments */
    .servizio-row .row {
        margin: 0;
    }
    
    .servizio-row .col-md-6,
    .servizio-row .col-md-2,
    .servizio-row .col-md-3,
    .servizio-row .col-md-1 {
        padding: 0.25rem;
    }
    
    .remove-servizio {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* Print styles */
@media print {
    .sidebar, .navbar, .btn, .modal {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Gap utilities for flexbox */
.gap-2 {
    gap: 0.5rem;
}

/* Chart container */
canvas {
    max-height: 400px;
}

/* Fix for Bootstrap modals */
.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

/* Ensure tooltips appear above modals */
.tooltip {
    z-index: 1070;
}

/* Better focus states */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Improved table styles */
.table > :not(caption) > * > * {
    vertical-align: middle;
}

/* Loading spinner improvements */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Sticky table headers */
.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}

.table thead th {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
}

/* Tabella Disponibilità - Colonna Azioni */
#vistaLista {
    overflow: visible;
}

#vistaLista .card-body {
    overflow-x: auto;
}

#disponibilitaTable th:last-child,
#disponibilitaTable td:last-child {
    min-width: 140px;
    white-space: nowrap;
    text-align: center;
}

#disponibilitaTable .btn-group {
    flex-wrap: nowrap;
    justify-content: center;
}

/* Override stile pulsanti 32x32 per tabella disponibilità (hanno testo) */
#disponibilitaTable .btn-group .btn,
#disponibilitaTable td .btn {
    width: auto !important;
    height: auto !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

#disponibilitaTable .btn-group .btn i,
#disponibilitaTable td .btn i {
    font-size: 0.75rem;
}

/* ========================================
   FORMS - MODERN FLAT DESIGN
   ======================================== */

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--ocean-300);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--ocean-100);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
}

/* Input Groups */
.input-group-text {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Form Text/Help */
.form-text {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Checkbox and Radio - Custom */
.form-check-input {
    width: 1.1em;
    height: 1.1em;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--ocean-100);
}

/* Switch */
.form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    border-radius: 1em;
}

/* Mobile Touch Optimization - Only for modals/forms, NOT DataTables */
@media (pointer: coarse) {
    .modal-body .form-control,
    .modal-body .form-select,
    .collapse .form-control,
    .collapse .form-select {
        min-height: 40px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    /* Exclude DataTables controls */
    .dataTables_wrapper .form-control,
    .dataTables_wrapper .form-select,
    .dataTables_filter input,
    .dataTables_length select {
        min-height: auto !important;
    }

    .form-check-input {
        width: 1.5em;
        height: 1.5em;
    }
}

/* Better form styling in modals */
.modal-body .form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.modal-body .form-control,
.modal-body .form-select {
    border-radius: var(--radius-md);
}

/* ========================================
   BUTTONS - FLAT DESIGN
   ======================================== */

.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    box-shadow: none !important;
}

/* No transform on hover - only color change */

/* Primary Button */
.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: white;
}

/* Secondary Button */
.btn-secondary {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: #475569;
    border-color: #475569;
    color: white;
}

/* Success Button */
.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-success:hover,
.btn-success:focus {
    background: #059669;
    border-color: #059669;
    color: white;
}

/* Danger Button */
.btn-danger {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.btn-danger:hover,
.btn-danger:focus {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Warning Button */
.btn-warning {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--text-primary);
}

.btn-warning:hover,
.btn-warning:focus {
    background: #d97706;
    border-color: #d97706;
    color: white;
}

/* Info Button */
.btn-info {
    background: var(--info-color);
    border-color: var(--info-color);
    color: white;
}

.btn-info:hover,
.btn-info:focus {
    background: var(--cyan-600);
    border-color: var(--cyan-600);
    color: white;
}

/* Light Button */
.btn-light {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-light:hover,
.btn-light:focus {
    background: var(--border-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Outline Buttons */
.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Override Bootstrap btn-check per usare colori tema */
.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-check:focus + .btn-outline-primary {
    box-shadow: 0 0 0 0.25rem rgba(45, 112, 166, 0.25);
}

.btn-outline-secondary {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
    background: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-outline-success {
    color: var(--success-color);
    border-color: var(--success-color);
    background: transparent;
}

.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-success.active {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-outline-danger {
    color: var(--danger-color);
    border-color: var(--danger-color);
    background: transparent;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger.active {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.btn-outline-info {
    color: var(--info-color);
    border-color: var(--info-color);
    background: transparent;
}

.btn-outline-info:hover,
.btn-outline-info:focus,
.btn-outline-info.active {
    background: var(--info-color);
    border-color: var(--info-color);
    color: white;
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Mobile Touch Targets - NOT for table action buttons */
@media (pointer: coarse) {
    /* Only apply to main action buttons, not table buttons */
    .modal-footer .btn,
    .card-header .btn:not(.btn-sm),
    form > .btn {
        min-height: 44px;
        padding: 0.625rem 1.25rem;
    }
}

/* Icon Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* ========================================
   TOOLBAR BUTTONS - ALIGNMENT FIX
   ======================================== */

/* Ensure icons are vertically centered in buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
}

/* Fix icon vertical alignment in buttons */
.btn i.fas,
.btn i.fa,
.btn i.far,
.btn i.fab {
    line-height: 1;
}

/* Small action buttons - smaller icons */
.btn-sm i.fas,
.btn-sm i.fa,
.btn-sm i.far,
.btn-sm i.fab {
    font-size: 0.75rem;
}

/* Icon-only buttons - no gap needed */
.btn-icon {
    gap: 0;
}

/* btn-group alignment */
.btn-group {
    display: inline-flex;
    align-items: stretch;
}

.btn-group > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar toggle button */
#sidebarToggle {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ocean-600) !important;
    border-color: var(--ocean-500) !important;
}

#sidebarToggle:hover {
    background-color: var(--ocean-500) !important;
    border-color: var(--ocean-400) !important;
    transform: none !important;
}

/* Improved button states */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

/* Custom outline button styles for filter */
.btn-outline-purple {
    color: #6f42c1;
    border-color: #6f42c1;
}

.btn-outline-purple:hover {
    color: #fff;
    background-color: #6f42c1;
    border-color: #6f42c1;
}

.btn-outline-purple.active,
.btn-outline-purple:active {
    color: #fff;
    background-color: #6f42c1;
    border-color: #6f42c1;
}

/* Badge purple per categoria SERVIZI */
.bg-purple {
    background-color: #6f42c1 !important;
    color: #fff !important;
}

/* Outline warning button - more visible border */
.btn-outline-warning {
    color: #b45309;
    border-color: #d97706;
    background: transparent;
}

.btn-outline-warning:hover {
    color: #fff;
    background-color: #d97706;
    border-color: #d97706;
}

.btn-outline-warning.active,
.btn-outline-warning:active {
    color: #fff;
    background-color: #d97706;
    border-color: #d97706;
}

/* Better spacing for form groups */
.mb-3:last-child {
    margin-bottom: 0 !important;
}

/* Fix for DataTables responsive */
.dataTables_wrapper .row {
    margin: 0;
}

.dataTables_wrapper .row > * {
    padding: 0;
}

/* Validation Feedback */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.is-invalid {
    border-color: #dc3545 !important;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

select.is-invalid {
    padding-right: 4.125rem;
    background-position: right 0.75rem center, center right 2.25rem;
    background-size: 16px 12px, calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

textarea.is-invalid {
    padding-right: calc(1.5em + 0.75rem);
    background-position: top calc(0.375em + 0.1875rem) right calc(0.375em + 0.1875rem);
}

/* Select2 validation styles */
.select2-container--bootstrap-5 .select2-selection.is-invalid {
    border-color: #dc3545 !important;
}

.select2-container--bootstrap-5 .select2-selection.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Toast improvements */
.toast-body {
    max-height: 300px;
    overflow-y: auto;
}

/* Dashboard Header Responsive */
.dashboard-header {
    margin-bottom: 1.5rem;
}

/* Dashboard Filter Buttons - Uniform square icons */
.dashboard-filter-btn {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0 !important;
}

.dashboard-filter-btn i {
    font-size: 0.875rem;
}

/* Mobile specific adjustments */
@media (max-width: 767px) {
    .dashboard-header .form-label {
        font-size: 0.75rem;
        color: #6c757d;
    }
    
    .dashboard-header .card-body {
        padding: 0.75rem;
    }
    
    .dashboard-header .btn-group .btn {
        font-size: 0.8rem;
    }
}

/* Improved date input styling on mobile */
@media (max-width: 576px) {
    input[type="date"] {
        font-size: 14px;
        padding: 0.375rem 0.5rem;
    }
}

/* Date input vertical alignment fix */
input[type="date"] {
    line-height: normal;
}

/* Dashboard filter date inputs */
.dashboard-header input[type="date"] {
    height: 38px;
}

/* Hardware acceleration for smoother animations */
.sidebar,
.navbar,
.main-content {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* Servizi specific styles */
.servizio-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.servizio-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* servizio-price styling moved to TABLE CONTENT STYLING section */

/* Prenotazioni specific styles */
.prenotazione-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.saldo-badge {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
}

.saldo-badge.saldo-zero {
    background-color: var(--success-color);
}

.saldo-badge.saldo-parziale {
    background-color: var(--warning-color);
}

.saldo-badge.saldo-totale {
    background-color: var(--danger-color);
}

/* Payment history styles */
.payment-history {
    max-height: 300px;
    overflow-y: auto;
}

.payment-item {
    border-left: 3px solid #dee2e6;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.payment-item.payment-entrata {
    border-left-color: var(--success-color);
}

/* Service selection in prenotazione */
.servizio-select-container {
    position: relative;
}

.servizio-info {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Responsive tables for prenotazioni */
@media (max-width: 768px) {
    .prenotazione-servizi-table {
        font-size: 0.875rem;
    }
    
    .prenotazione-servizi-table th,
    .prenotazione-servizi-table td {
        padding: 0.5rem;
    }
}

/* Tab error indicators */
.nav-tabs .nav-link .error-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    vertical-align: top;
}

.validation-summary {
    margin-bottom: 1rem;
}

.validation-summary ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.validation-summary li {
    font-size: 0.9rem;
}

/* Evidenzia il tab con errori */
.nav-tabs .nav-link:has(.error-badge) {
    color: var(--danger-color) !important;
}

/* Placeholder Styles - Colore più chiaro */
::placeholder {
    color: #d1d5db !important;
    opacity: 1 !important;
}

::-webkit-input-placeholder {
    color: #d1d5db !important;
}

:-moz-placeholder {
    color: #d1d5db !important;
    opacity: 1 !important;
}

::-moz-placeholder {
    color: #d1d5db !important;
    opacity: 1 !important;
}

:-ms-input-placeholder {
    color: #d1d5db !important;
}

::-ms-input-placeholder {
    color: #d1d5db !important;
}
/* Stili per intl-tel-input */
.iti {
    width: 100%;
}

.iti__flag-container {
    z-index: 1051; /* Per essere sopra i modal Bootstrap */
}

.iti__country-list {
    z-index: 1052;
    width: 300px;
}

/* Pulsante WhatsApp */
.whatsapp-button {
    background-color: #25d366;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s;
}

.whatsapp-button:hover {
    background-color: #128c7e;
    color: white;
    text-decoration: none;
}

.whatsapp-button i {
    font-size: 16px;
}

/* ========================================
   LAYOUT DESIGNER & MAPPA SERVIZI
   Sezione consolidata - unica fonte di verita'
   ======================================== */

/* Layout Canvas Container - UNICO gradient per designer e mappa */
.layout-canvas-container {
    position: relative;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: linear-gradient(to bottom, #87CEEB 0%, #87CEEB 12%, #F4E4BC 12%, #F4E4BC 100%);
    background-attachment: local;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 600px;
    max-height: 80vh;
}

/* Canvas interno */
.layout-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 1400px;
    min-height: 800px;
    border-radius: 0.375rem;
    background: transparent;
}

.layout-canvas.show-grid {
    background-image:
        linear-gradient(rgba(0,0,0,.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.1) 1px, transparent 1px);
    background-size: 25px 25px;
}

.layout-canvas.drag-over,
.layout-canvas-container.drag-over {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.05);
}

/* Mappa Disponibilita' - STESSO gradient del designer */
.mappa-disponibilita {
    position: relative;
    width: 100%;
    min-height: 600px;
    background: linear-gradient(to bottom, #87CEEB 0%, #87CEEB 12%, #F4E4BC 12%, #F4E4BC 100%);
    background-attachment: local;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border-radius: 0.375rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 80vh;
}

/* Palette Servizi */
.servizi-palette {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px;
    background: #f8f9fa;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.servizio-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: grab;
    transition: all 0.2s ease;
    min-width: 120px;
    gap: 8px;
}

.servizio-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.servizio-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.servizio-icon {
    font-size: 1.25rem;
    color: #0d6efd;
    width: 24px;
    text-align: center;
}

.servizio-info {
    flex: 1;
    min-width: 0;
}

.servizio-nome {
    display: block;
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.servizio-codice {
    display: block;
    font-size: 0.6875rem;
    color: #666;
}

/* ---- Layout Items ---- */
.layout-item {
    position: absolute;
    width: 80px;
    height: 80px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    z-index: 10;
}

.layout-item:hover {
    transform: scale(1.05);
    z-index: 20;
}

.layout-item.selected {
    outline: 3px solid #007bff;
    outline-offset: 2px;
    z-index: 20;
}

.layout-item.dragging {
    opacity: 0.8;
    transform: scale(1.05);
    z-index: 1000;
}

.layout-item-content {
    width: 100%;
    height: 100%;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.layout-item-icon {
    font-size: 1.1rem;
    color: #0d6efd;
    margin-bottom: 0.1rem;
}

.layout-item-nome {
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.1;
    max-width: 70px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    word-break: break-word;
    color: #333;
}

.layout-item-codice {
    font-size: 0.6rem;
    color: #495057;
    text-align: center;
}

/* ---- Status Indicators ---- */
.layout-item-status {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-item-status[data-status="libero"] {
    background-color: #198754;
}

.layout-item-status[data-status="occupato"] {
    background-color: #dc3545;
}

.layout-item-status[data-status="parziale"],
.layout-item-status[data-status="non_pagato"] {
    background-color: #ffc107;
}

.layout-item-status[data-status="parziale"] {
    animation: pulse 2s infinite;
}

.layout-item-status .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* ---- Status background gradients ---- */
.layout-item.stato-libero .layout-item-content {
    background: linear-gradient(135deg, #d1e7dd, #badbcc);
    border-color: #198754;
}

.layout-item.stato-occupato .layout-item-content {
    background: linear-gradient(135deg, #f8d7da, #f1aeb5);
    border-color: #dc3545;
}

.layout-item.stato-parziale .layout-item-content,
.layout-item.stato-non_pagato .layout-item-content {
    background: linear-gradient(135deg, #fff3cd, #ffe69c);
    border-color: #ffc107;
}

/* Nome cliente sull'istanza occupata */
.layout-item-cliente {
    font-size: 9px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 2px;
}

/* ---- Actions ---- */
.layout-item-actions {
    position: absolute;
    top: -8px;
    left: -8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.layout-item:hover .layout-item-actions {
    opacity: 1;
}

.layout-item-actions .btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    aspect-ratio: 1 / 1 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    line-height: 1 !important;
}

.layout-item-actions .btn i {
    font-size: 12px !important;
    line-height: 1 !important;
    width: auto !important;
    height: auto !important;
}

.layout-item-actions .btn:hover {
    transform: none !important;
}

/* ---- Toolbar ---- */
.toolbar {
    border: 1px solid #dee2e6;
}

.toolbar h6 {
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ---- Z-index fix per modals ---- */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

#prenotazioneRapidaModal {
    z-index: 1060 !important;
}

/* ---- jQuery UI Compatibility ---- */
.ui-draggable {
    cursor: move;
}

.ui-draggable-dragging {
    opacity: 0.8;
    z-index: 1000;
}

/* ---- Animazioni ---- */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive: Desktop (>=992px) ---- */
@media (min-width: 992px) {
    .mappa-disponibilita {
        max-height: 75vh;
    }

    .layout-canvas-container {
        min-height: 600px;
    }

    #layoutDesigner .col-md-3 {
        max-height: 75vh;
        overflow-y: auto;
    }

    .servizi-palette {
        max-height: 300px;
        overflow-y: auto;
    }
}

/* ---- Responsive: Tablet (768px - 991px) ---- */
@media (max-width: 991px) and (min-width: 768px) {
    #layoutDesigner .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    #layoutDesigner .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .servizi-palette {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        max-height: 200px;
        overflow-y: auto;
    }

    .servizio-item {
        flex: 0 0 calc(50% - 4px);
        margin-bottom: 0 !important;
    }

    .mappa-disponibilita {
        max-height: 60vh;
    }
}

/* ---- Responsive: Mobile (<768px) ---- */
@media (max-width: 767px) {
    .layout-canvas-container {
        max-height: 50vh;
        min-height: 400px;
    }

    .mappa-disponibilita {
        max-height: 50vh;
        min-height: 300px;
    }

    .layout-item {
        width: 70px;
        height: 70px;
    }

    .layout-item-nome {
        font-size: 0.6rem;
        max-width: 60px;
    }

    .layout-item-codice {
        font-size: 0.5rem;
    }

    .layout-item-icon {
        font-size: 0.9rem;
    }

    .servizi-palette {
        max-height: 150px;
    }

    .servizio-item {
        flex: 0 0 calc(50% - 3px);
        min-width: 100px;
        padding: 6px;
    }

    .servizio-nome {
        font-size: 11px;
    }

    .servizio-codice {
        font-size: 9px;
    }

    #vistaMappa .card-header {
        padding: 0.5rem 0.75rem;
    }

    #vistaMappa .card-body {
        padding: 0.5rem;
    }

    #layoutDesigner .card-header {
        padding: 0.5rem 0.75rem;
    }

    #layoutDesigner .card-body {
        padding: 0.75rem;
    }

    #layoutDesigner .col-md-3,
    #layoutDesigner .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #layoutDesigner .col-md-3 {
        order: 2;
        margin-top: 15px;
    }

    #layoutDesigner .col-md-9 {
        order: 1;
    }

    .disponibilita-container .row.mb-4 > div {
        margin-bottom: 10px;
    }

    .disponibilita-container .btn-group[role="group"] .btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .disponibilita-container .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .disponibilita-container .legenda-container {
        width: 100%;
        margin-top: 8px;
    }

    .grid-controls-inline {
        padding: 10px;
    }

    .grid-controls-inline h6 {
        font-size: 0.85rem;
    }
}

/* ---- Touch devices optimization ---- */
@media (hover: none) and (pointer: coarse) {
    .layout-item {
        min-width: 60px;
        min-height: 60px;
    }

    .layout-item:hover {
        transform: none;
        box-shadow: none;
    }

    .layout-item:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    }
}

/* ========================================
   BOTTOM NAVIGATION - MOBILE
   ======================================== */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bottom-nav-bg);
    border-top: 1px solid var(--bottom-nav-border);
    z-index: 1040;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--spacing-sm);
    /* iOS safe area support */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }

    /* Hide sidebar completely on mobile */
    .sidebar {
        display: none !important;
    }

    /* Hide sidebar toggle on mobile */
    #sidebarToggle {
        display: none !important;
    }

    /* Hide sidebar overlay on mobile */
    .sidebar-overlay {
        display: none !important;
    }

    /* Adjust main content for bottom nav */
    .main-content {
        margin-left: 0 !important;
        padding-bottom: calc(var(--bottom-nav-height) + var(--spacing-xl) + env(safe-area-inset-bottom, 0));
    }

    /* Navbar adjustments for mobile */
    .navbar {
        left: 0 !important;
        height: 56px;
    }

    /* Toast container above bottom nav */
    .toast-container {
        bottom: calc(var(--bottom-nav-height) + 1rem + env(safe-area-inset-bottom, 0)) !important;
    }

    /* Ensure DataTables pagination is not hidden by bottom nav */
    .dataTables_wrapper {
        padding-bottom: var(--spacing-md);
    }

    /* Card content has enough space for pagination */
    .card-body {
        padding-bottom: var(--spacing-lg);
    }

    /* Ensure last card on page has extra bottom margin */
    .card:last-child {
        margin-bottom: var(--spacing-xl);
    }

    /* Exclude filter cards and totals cards from extra margin */
    .collapse .card,
    #movimentiTotals .card {
        margin-bottom: 0 !important;
    }

    /* Ensure modals don't get hidden by bottom nav */
    .modal-dialog {
        margin-bottom: calc(var(--bottom-nav-height) + 1rem);
    }

    /* Extra safety margin for page content */
    #mainContent > *:last-child {
        margin-bottom: calc(var(--bottom-nav-height) + var(--spacing-md)) !important;
    }

    /* Ensure all tables have bottom padding */
    .table-responsive {
        padding-bottom: var(--spacing-md);
    }

    /* Alert and info boxes at bottom need margin */
    .alert:last-child {
        margin-bottom: calc(var(--bottom-nav-height) + var(--spacing-md));
    }

    /* Ensure DataTables info and pagination have enough space */
    .dataTables_info,
    .dataTables_paginate {
        margin-bottom: var(--spacing-md);
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.6875rem;
    font-weight: 500;
    gap: 2px;
    transition: color 0.2s ease;
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.bottom-nav-item:hover,
.bottom-nav-item:active {
    color: var(--primary-color);
    text-decoration: none;
}

.bottom-nav-item.active {
    color: var(--bottom-nav-active);
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

.bottom-nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile Menu Offcanvas */
.mobile-menu-offcanvas {
    max-height: 60vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.mobile-menu-offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
}

.mobile-menu-offcanvas .offcanvas-body {
    padding: var(--spacing-lg);
}

.mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.mobile-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg) var(--spacing-md);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    gap: var(--spacing-sm);
    transition: all 0.2s ease;
    min-height: 80px;
}

.mobile-menu-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
    background: var(--primary-light);
    transform: scale(0.98);
    text-decoration: none;
    color: var(--text-primary);
}

/* ========================================
   ANIMATIONS & TRANSITIONS - FINAL POLISH
   ======================================== */

/* Smooth page transitions */
.main-content {
    animation: fadeInContent 0.3s ease;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card entrance animation */
.card {
    animation: fadeInUp 0.4s ease backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple cards */
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }

/* Toast slide-in animation */
.toast {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Custom Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   DATATABLES MOBILE OPTIMIZATION
   ======================================== */

@media (max-width: 767.98px) {
    /* === HEADER: Titolo + Pulsanti === */
    .d-md-none h1.h4 {
        font-size: 1.15rem !important;
    }

    .d-md-none .btn-group .btn,
    .d-md-none > .btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }

    .d-md-none .btn-group .btn i,
    .d-md-none > .btn i {
        font-size: 0.7rem !important;
    }

    /* === CARD BODY COMPATTO === */
    .card-body {
        padding: 0.75rem !important;
    }

    /* === DATATABLES: Length + Filter sulla stessa riga === */
    .dataTables_wrapper .row:first-child {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        gap: 0.5rem;
        margin-bottom: 0.5rem !important;
        padding: 0 !important;
    }

    .dataTables_wrapper .row:first-child > div {
        flex: 0 0 auto !important;
        width: auto !important;
        padding: 0 !important;
        max-width: none !important;
        display: flex !important;
        align-items: center !important;
    }

    .dataTables_wrapper .row:first-child > div:last-child {
        flex: 1 1 auto !important;
        min-width: 80px !important;
    }

    .dataTables_wrapper .dataTables_length {
        margin-bottom: 0 !important;
        flex-shrink: 0 !important;
    }

    .dataTables_wrapper .dataTables_length label {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.3rem;
        font-size: 0.6875rem !important;
        margin: 0;
        white-space: nowrap;
        height: 28px;
    }

    /* Select compatto - allineato al centro */
    .dataTables_wrapper .dataTables_length select {
        font-size: 16px;
        height: 24px !important;
        padding: 0 1.25rem 0 0.35rem !important;
        width: auto !important;
        min-width: 50px;
        border-radius: 4px;
        background-size: 10px;
        margin: 0 !important;
        vertical-align: middle !important;
    }

    .dataTables_wrapper .dataTables_filter {
        margin-bottom: 0 !important;
        flex: 1 1 auto !important;
        min-width: 80px !important;
    }

    .dataTables_wrapper .dataTables_filter label {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.3rem;
        font-size: 0.6875rem !important;
        margin: 0;
        width: 100%;
        height: 28px;
    }

    .dataTables_wrapper .dataTables_filter input {
        font-size: 16px;
        height: 24px !important;
        padding: 0 0.5rem !important;
        flex: 1 1 auto;
        min-width: 50px !important;
        width: 100% !important;
        border-radius: 4px;
        margin: 0 !important;
        box-sizing: border-box;
    }

    /* === TABELLA === */
    table.dataTable {
        font-size: 0.8125rem !important;
    }

    table.dataTable thead th {
        padding: 0.5rem 0.25rem !important;
        font-size: 0.6875rem !important;
        font-weight: 600;
    }

    table.dataTable tbody td {
        padding: 0.5rem 0.25rem !important;
        vertical-align: middle;
    }

    /* === PULSANTI AZIONI IN TABELLA - touch-friendly 32x32 === */
    table.dataTable .btn-group .btn,
    table.dataTable td .btn-sm {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        font-size: 0.6875rem !important;
        line-height: 32px !important;
        border-radius: 6px !important;
    }

    table.dataTable .btn-group .btn i,
    table.dataTable td .btn-sm i {
        font-size: 0.6rem !important;
    }

    table.dataTable .btn-group {
        gap: 4px;
    }

    /* === BADGE IN TABELLA - leggibili === */
    table.dataTable .badge {
        font-size: 0.6875rem !important;
        padding: 0.3em 0.55em !important;
        border-radius: 4px !important;
    }

    /* === RIGHE ESPANSE - Mobile Ottimizzato === */
    table.dataTable > tbody > tr.child ul.dtr-details {
        grid-template-columns: repeat(2, 1fr) !important;
        padding: 8px !important;
        gap: 6px !important;
    }

    table.dataTable > tbody > tr.child ul.dtr-details > li {
        padding: 8px 10px !important;
        min-height: 48px !important;
    }

    table.dataTable > tbody > tr.child ul.dtr-details > li:first-child {
        padding-top: 8px !important;
    }

    table.dataTable > tbody > tr.child span.dtr-title {
        font-size: 0.5625rem !important;
        margin-bottom: 2px !important;
    }

    table.dataTable > tbody > tr.child span.dtr-data {
        font-size: 0.75rem !important;
    }

    table.dataTable > tbody > tr.child .badge {
        font-size: 0.625rem !important;
        padding: 0.2em 0.45em !important;
    }

    /* Azioni: full width su mobile */
    table.dataTable > tbody > tr.child ul.dtr-details > li:has(.btn-group),
    table.dataTable > tbody > tr.child ul.dtr-details > li:has(.btn),
    table.dataTable > tbody > tr.child ul.dtr-details > li.dtr-actions-row {
        padding: 8px 10px !important;
        min-height: auto !important;
    }

    table.dataTable > tbody > tr.child .btn-group .btn,
    table.dataTable > tbody > tr.child .btn-sm,
    table.dataTable > tbody > tr.child .btn {
        width: 34px !important;
        height: 34px !important;
    }

    table.dataTable > tbody > tr.child .btn-group .btn i,
    table.dataTable > tbody > tr.child .btn-sm i,
    table.dataTable > tbody > tr.child .btn i {
        font-size: 0.6875rem !important;
    }

    /* === PAGINAZIONE === */
    .dataTables_wrapper .dataTables_info {
        font-size: 0.6875rem !important;
        padding-top: 0.5rem !important;
        text-align: center;
    }

    .dataTables_wrapper .dataTables_paginate {
        padding-top: 0.5rem !important;
        display: flex;
        justify-content: center;
    }

    /* Paginazione unita come desktop */
    .dataTables_wrapper .dataTables_paginate .page-link {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.75rem !important;
        min-width: 32px;
        min-height: 32px;
        border-radius: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: -1px;
    }

    .dataTables_wrapper .dataTables_paginate .page-item:first-child .page-link {
        border-top-left-radius: 6px !important;
        border-bottom-left-radius: 6px !important;
        margin-left: 0;
    }

    .dataTables_wrapper .dataTables_paginate .page-item:last-child .page-link {
        border-top-right-radius: 6px !important;
        border-bottom-right-radius: 6px !important;
    }

    /* === FILTRI COLLASSABILI === */
    .collapse .card-body {
        padding: 0.75rem !important;
    }

    .collapse .form-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.2rem !important;
    }

    .collapse .form-control,
    .collapse .form-select {
        font-size: 16px;
        height: 40px !important;
        padding: 0.25rem 0.5rem !important;
        border-radius: 10px !important;
    }

    .collapse .row.g-2 {
        --bs-gutter-y: 0.5rem;
        --bs-gutter-x: 0.5rem;
    }

    /* === TOTALI MOVIMENTI === */
    #movimentiTotals .card-body {
        padding: 0.5rem !important;
    }

    #movimentiTotals small {
        font-size: 0.65rem !important;
    }

    #movimentiTotals strong {
        font-size: 0.8rem !important;
    }

    /* === FILTRI CATEGORIA SERVIZI - scrollabile === */
    #categoryFilter {
        display: flex !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding-bottom: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    #categoryFilter::-webkit-scrollbar {
        display: none;
    }

    #categoryFilter .btn {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0.35rem 0.5rem !important;
        font-size: 0.6875rem !important;
        border-radius: 6px !important;
    }

    #categoryFilter .btn i {
        font-size: 0.65rem !important;
    }

    /* === MARGINS === */
    .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .mb-3 {
        margin-bottom: 0.5rem !important;
    }

    /* === ALERTS === */
    .alert {
        padding: 0.75rem 1rem !important;
        font-size: 0.8125rem !important;
        border-radius: 10px !important;
    }

    .alert .btn-close {
        padding: 0.6rem !important;
    }
}

/* iOS input zoom fix */
@supports (-webkit-touch-callout: none) {
    .dataTables_filter input,
    .dataTables_length select {
        font-size: 16px !important;
    }
}

/* Touch feedback migliorato */
@media (pointer: coarse) {
    .btn:active {
        transform: scale(0.97) !important;
    }

    table.dataTable tbody tr {
        -webkit-tap-highlight-color: transparent;
    }

    table.dataTable tbody tr:active {
        background-color: rgba(14, 165, 233, 0.1) !important;
    }

    table.dataTable > tbody > tr.child ul.dtr-details > li:active {
        background-color: rgba(14, 165, 233, 0.08) !important;
    }
}

/* ===================
   DATATABLES RESPONSIVE - Righe Espanse Globali
   =================== */

/* Container riga espansa */
table.dataTable > tbody > tr.child {
    background: #f1f3f5 !important;
}

table.dataTable > tbody > tr.child > td {
    padding: 0 !important;
    border: none !important;
    border-top: 1px solid #dee2e6 !important;
}

/* Lista dati espansa - layout griglia uniforme */
table.dataTable > tbody > tr.child ul.dtr-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px 16px;
    margin: 0;
    list-style: none;
    width: 100%;
}

/* Singolo item della griglia */
table.dataTable > tbody > tr.child ul.dtr-details > li {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 10px 12px !important;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    min-height: 54px;
}

/* Override DataTables Responsive default - rimuove padding-top:0 dal primo elemento */
table.dataTable > tbody > tr.child ul.dtr-details > li:first-child {
    padding-top: 10px !important;
}

/* Titolo/Label - sempre allineato a sinistra */
table.dataTable > tbody > tr.child span.dtr-title {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    text-align: left;
    line-height: 1;
}

/* Valore - sempre allineato a sinistra */
table.dataTable > tbody > tr.child span.dtr-data {
    font-size: 0.875rem;
    color: #212529;
    word-break: break-word;
    line-height: 1.3;
    text-align: left;
}

/* Badge nelle righe espanse - allineamento sinistra */
table.dataTable > tbody > tr.child .badge {
    font-size: 0.6875rem !important;
    padding: 0.3em 0.6em !important;
    font-weight: 500;
}

/* Riga Azioni - full width con layout orizzontale */
table.dataTable > tbody > tr.child ul.dtr-details > li:has(.btn-group),
table.dataTable > tbody > tr.child ul.dtr-details > li:has(.btn),
table.dataTable > tbody > tr.child ul.dtr-details > li.dtr-actions-row {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e9ecef;
    padding: 10px 12px;
    min-height: auto;
}

table.dataTable > tbody > tr.child .btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

table.dataTable > tbody > tr.child .btn-group .btn,
table.dataTable > tbody > tr.child .btn-sm,
table.dataTable > tbody > tr.child .btn {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
}

table.dataTable > tbody > tr.child .btn-group .btn i,
table.dataTable > tbody > tr.child .btn-sm i,
table.dataTable > tbody > tr.child .btn i {
    font-size: 0.8125rem !important;
}

/* Saldo con colore */
table.dataTable > tbody > tr.child span.dtr-data .text-success,
table.dataTable > tbody > tr.child span.dtr-data .text-danger {
    font-weight: 600;
}

/* Tablet: 3 colonne */
@media (min-width: 769px) and (max-width: 1199px) {
    table.dataTable > tbody > tr.child ul.dtr-details {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* === TABLET DATATABLES CONTROLS FIX (768px - 1024px) === */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Contenitore wrapper - evita overflow */
    .dataTables_wrapper {
        overflow: hidden !important;
    }

    /* Prima riga: length + filter - STESSA RIGA */
    .dataTables_wrapper .row:first-child {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem;
        overflow: hidden !important;
    }

    .dataTables_wrapper .row:first-child > div {
        flex: 0 1 auto !important;
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .dataTables_wrapper .dataTables_length {
        flex: 0 0 auto !important;
    }

    .dataTables_wrapper .dataTables_filter {
        flex: 1 1 0 !important;
        text-align: right !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .dataTables_wrapper .dataTables_filter label {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        width: 100% !important;
        gap: 0.5rem;
        margin: 0 !important;
    }

    .dataTables_wrapper .dataTables_filter input {
        flex: 0 1 200px !important;
        min-width: 80px !important;
        max-width: 200px !important;
        width: 100% !important;
        margin-left: 0 !important;
        box-sizing: border-box !important;
    }

    /* Ultima riga: info + paginate - STESSA RIGA */
    .dataTables_wrapper .row:last-child {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem;
        overflow: hidden !important;
    }

    .dataTables_wrapper .row:last-child > div {
        flex: 0 1 auto !important;
        width: auto !important;
        padding: 0 !important;
    }

    .dataTables_wrapper .dataTables_info {
        font-size: 0.875rem !important;
        white-space: nowrap;
        flex-shrink: 1 !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dataTables_wrapper .dataTables_paginate {
        margin-top: 0 !important;
        flex-shrink: 0 !important;
    }

    .dataTables_wrapper .dataTables_paginate .page-link {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.875rem !important;
    }
}

/* Desktop grande: 4 colonne (default già impostato) */

/* === DATATABLES RESPONSIVE - Icona espansione globale === */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    position: relative;
    padding-left: 28px !important;
    cursor: pointer;
}

/* Nascondi icona default DataTables */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
    content: '\f055' !important; /* FontAwesome plus-circle */
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free' !important;
    font-weight: 900 !important;
    position: absolute !important;
    left: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 15px !important;
    color: #0d6efd !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    transition: color 0.2s ease, transform 0.2s ease !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control::before {
    content: '\f056' !important; /* FontAwesome minus-circle */
    color: #dc3545 !important;
}

/* Hover effect */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:hover::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:hover::before {
    transform: translateY(-50%) scale(1.1) !important;
}

/* ===================
   Print Optimization
   =================== */

@media print {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dataTables_info,
    .dt-actions-cell,
    table.dataTable th:last-child,
    table.dataTable td:last-child {
        display: none !important;
    }

    table.dataTable {
        width: 100% !important;
    }

    table.dataTable tbody td {
        padding: 8px;
        font-size: 10pt;
    }
}

/* ===================
   iOS Safe Area
   =================== */

@supports (padding: max(0px)) {
    .main-content {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ===================
   Servizio Details Modal
   =================== */

#servizioDetailsModal .modal-dialog {
    max-width: 450px;
    margin: 0.5rem;
}

/* Uses .modal-header-beach, .modal-content-beach, .modal-footer-beach */

#servizioDetailsModal .modal-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Icon containers */
#servizioDetailsModal .bg-primary.bg-opacity-10 {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Payment summary cards */
#servizioDetailsModal .row.g-2 > div > div {
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Mobile-specific styles */
@media (max-width: 575.98px) {
    #servizioDetailsModal .modal-dialog {
        margin: 0;
        min-height: 100vh;
        max-width: 100%;
    }

    #servizioDetailsModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    #servizioDetailsModal .modal-header {
        border-radius: 0;
    }

    #servizioDetailsModal .modal-body {
        max-height: calc(100vh - 140px);
    }

    #servizioDetailsModal .modal-footer {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
    }

    #servizioDetailsModal .modal-footer .btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

/* Tablet and small desktop */
@media (min-width: 576px) {
    #servizioDetailsModal .modal-dialog {
        margin: 1.75rem auto;
    }

    #servizioDetailsModal .modal-footer {
        flex-direction: row;
        gap: 0.5rem;
    }

    #servizioDetailsModal .modal-footer .btn {
        width: auto;
        flex: 1;
    }

    #servizioDetailsModal .w-sm-auto {
        width: auto !important;
    }
}

/* Larger screens */
@media (min-width: 768px) {
    #servizioDetailsModal .modal-dialog {
        max-width: 480px;
    }
}

/* ===================
   Prenotazione Rapida Modal
   =================== */

#prenotazioneRapidaModal .modal-dialog {
    max-width: 500px;
    margin: 0.5rem;
}

/* Uses .modal-header-beach, .modal-content-beach, .modal-footer-beach */

#prenotazioneRapidaModal .modal-body {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* Servizio header */
#prenotazioneRapidaModal .servizio-header {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(6, 182, 212, 0.15) 100%);
}

#prenotazioneRapidaModal .servizio-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form labels */
#prenotazioneRapidaModal .form-label-sm {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Pagamento section */
#prenotazioneRapidaModal .pagamento-section {
    background-color: var(--bg-secondary);
}

#prenotazioneRapidaModal .form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    margin-right: 0.5rem;
}

#prenotazioneRapidaModal .form-switch .form-check-label {
    padding-left: 0.25rem;
}

/* Totale servizio badge */
#prenotazioneRapidaModal .totale-servizio-badge {
    border-color: var(--ocean-200) !important;
    background: linear-gradient(135deg, #ffffff 0%, var(--ocean-50) 100%) !important;
}

/* Allineamento input importo e select metodo */
#prenotazioneRapidaModal #sezione_pagamento_rapido .input-group .form-control,
#prenotazioneRapidaModal #sezione_pagamento_rapido .input-group .input-group-text,
#prenotazioneRapidaModal #sezione_pagamento_rapido .form-select {
    height: auto;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Mobile-specific styles */
@media (max-width: 575.98px) {
    #prenotazioneRapidaModal .modal-dialog {
        margin: 0;
        min-height: 100vh;
        max-width: 100%;
    }

    #prenotazioneRapidaModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    #prenotazioneRapidaModal .modal-header {
        border-radius: 0;
    }

    #prenotazioneRapidaModal .modal-body {
        flex: 1;
        max-height: none;
        overflow-y: auto;
    }

    #prenotazioneRapidaModal .modal-footer {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        box-shadow: 0 -2px 10px rgb(0 0 0 / 0.1);
    }

    #prenotazioneRapidaModal .modal-footer .btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    /* Make form inputs larger for touch */
    #prenotazioneRapidaModal .form-control,
    #prenotazioneRapidaModal .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    #prenotazioneRapidaModal .input-group-text {
        min-height: 44px;
    }

    /* Stack date fields on very small screens */
    #prenotazioneRapidaModal .row.g-2 > .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Larger switch for touch */
    #prenotazioneRapidaModal .form-switch .form-check-input {
        width: 3em;
        height: 1.5em;
    }
}

/* Tablet and small desktop */
@media (min-width: 576px) {
    #prenotazioneRapidaModal .modal-dialog {
        margin: 1.75rem auto;
    }

    #prenotazioneRapidaModal .modal-footer {
        flex-direction: row;
        gap: 0.5rem;
    }

    #prenotazioneRapidaModal .modal-footer .btn {
        width: auto;
        flex: 1;
    }

    #prenotazioneRapidaModal .w-sm-auto {
        width: auto !important;
    }

    /* Restore side-by-side date fields */
    #prenotazioneRapidaModal .row.g-2 > .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Larger screens */
@media (min-width: 768px) {
    #prenotazioneRapidaModal .modal-dialog {
        max-width: 520px;
    }
}

/* ========================================
   ADDRESS AUTOCOMPLETE STYLES
   ======================================== */

.address-autocomplete {
    position: relative;
}

.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.address-suggestions.show {
    display: block;
}

.address-suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.15s ease;
}

.address-suggestion-item:last-child {
    border-bottom: none;
}

.address-suggestion-item:hover {
    background-color: var(--ocean-50);
}

.address-suggestion-item .address-main {
    font-weight: 500;
    color: var(--text-primary);
}

.address-suggestion-item .address-detail {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.address-loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.address-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Select2 dentro modal prenotazione rapida */
#prenotazioneRapidaModal .select2-container {
    width: 100% !important;
}

#prenotazioneRapidaModal .select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
}

@media (max-width: 575.98px) {
    #prenotazioneRapidaModal .select2-container--bootstrap-5 .select2-selection {
        min-height: 44px;
        font-size: 16px;
    }
}

/* ===================
   View Prenotazione Modal
   =================== */

#viewPrenotazioneModal .modal-dialog {
    max-width: 900px;
}

/* Uses .modal-header-beach, .modal-content-beach, .modal-footer-beach */

#viewPrenotazioneModal .modal-body {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* Summary cards */
#viewPrenotazioneModal .summary-card {
    text-align: center;
}

/* Section headers */
#viewPrenotazioneModal .section-header {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Movimenti list - no hover effects */

/* Mobile-specific styles */
@media (max-width: 767.98px) {
    #viewPrenotazioneModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    #viewPrenotazioneModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    #viewPrenotazioneModal .modal-header-beach {
        border-radius: 0;
    }

    #viewPrenotazioneModal .modal-body {
        max-height: calc(100vh - 120px);
    }

    #viewPrenotazioneModal .modal-footer {
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid var(--border-color);
    }

    /* Compact buttons on mobile */
    #viewPrenotazioneModal .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    #viewPrenotazioneModal .modal-dialog {
        max-width: 700px;
        margin: 1.75rem auto;
    }
}

/* ===================
   View Movimento Modal
   =================== */

#viewMovimentoModal .modal-dialog {
    max-width: 450px;
    margin: 0.5rem;
}

/* Uses .modal-header-beach, .modal-content-beach, .modal-footer-beach */

#viewMovimentoModal .modal-body {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* Movimento detail header */
#viewMovimentoModal .movimento-detail-header {
    border-bottom: 1px solid var(--border-color);
}

/* Detail items */
#viewMovimentoModal .detail-item small {
    font-size: 0.75rem;
}

/* Mobile-specific styles */
@media (max-width: 575.98px) {
    #viewMovimentoModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    #viewMovimentoModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    #viewMovimentoModal .modal-header-beach {
        border-radius: 0;
    }

    #viewMovimentoModal .modal-body {
        max-height: calc(100vh - 120px);
    }

    #viewMovimentoModal .modal-footer {
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid var(--border-color);
    }
}

/* Tablet and desktop */
@media (min-width: 576px) {
    #viewMovimentoModal .modal-dialog {
        margin: 1.75rem auto;
    }
}

/* ========================================
   PLANNER - DayPilot Scheduler
   ======================================== */

/* Container principale - deve occupare tutta la larghezza */
#schedulerContainer {
    width: 100%;
    height: calc(100vh - 280px);
    min-height: 400px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

/* Planner navigation buttons */
.planner-nav {
    display: flex;
    gap: 0.25rem;
}

/* Planner zoom buttons */
.planner-zoom .btn.active {
    background-color: var(--primary-color, #0d6efd);
    color: white;
    border-color: var(--primary-color, #0d6efd);
}

/* Legenda */
.planner-legend {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

.planner-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.planner-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.planner-legend-color.pagato { background: #4caf50; }
.planner-legend-color.parziale { background: #ff9800; }
.planner-legend-color.non-pagato { background: #f44336; }
.planner-legend-color.annullata { background: #9e9e9e; }

/* Empty state */
.planner-empty {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    color: var(--text-secondary, #6c757d);
    text-align: center;
}

.planner-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Loading spinner */
.planner-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    z-index: 100;
    font-size: 0.95rem;
    color: var(--text-secondary, #6c757d);
}

.planner-loading .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
}

