/* public/css/layout.css - CLEANED & MERGED */

/* --- 1. LAYOUT STRUTTURALE (GRID SYSTEM) --- */

/* Wrapper Principale */
.dashboard-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden; /* Blocca lo scroll della pagina intera */
    background: #f1f5f9; /* Slate-100 background base */
}

.sidebar {
    flex-shrink: 0; 
}

.main-content {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    /* Spazio per la Top Bar fluttuante */
    padding: 0; 
    overflow: hidden; 
}

/* Griglia Dashboard Full Height */
.dashboard-grid {
    display: flex;
    gap: 24px;
    flex: 1;            
    height: 100%;       
    min-height: 0;      
    width: 100%;
    padding: 0 30px 20px 30px; /* Padding contenuto */
    overflow: hidden;
}

/* Colonne */
.col-left, .col-center {
    display: flex;
    flex-direction: column;
    height: 100%;       
    max-height: 100%;   
    min-height: 0;
    gap: 15px;
    overflow: visible; /* Per drag & drop */
}

.col-right {
    display: flex;
    flex-direction: column;
    height: 100%; 
    max-height: 100%; 
    min-height: 0;
    overflow: hidden !important; /* Blocco totale overflow */
}

/* Larghezze Colonne */
.col-left   { flex: 1; }   
.col-center { flex: 1.6; } 
.col-right  { flex: 1; }

.flex-grow {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}


/* --- 2. TOP BAR "FLOATING ISLAND" (Versione Definitiva) --- */
.top-bar {
    /* Posizionamento Fluttuante */
    margin: 24px 20px 24px 20px;
    padding: 16px 24px;
    
    /* Effetto Vetro Premium */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    
    /* Ombra profonda */
    box-shadow: 
        0 10px 30px -10px rgba(0, 0, 0, 0.05),
        0 4px 6px -2px rgba(0, 0, 0, 0.01),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    /* Sticky */
    position: sticky;
    top: 20px;
    z-index: 40;
}

/* Titoli Header */
.header-titles {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-titles h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.03em;
    
    /* Sfumatura testo */
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* --- 3. CLIENT SELECTOR & HEADER ACTIONS --- */

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative; 
    z-index: 100; /* Importante per i dropdown */
}

/* Bottone "Gestisci Clienti" */
#btn-manage-clients {
    height: 48px; /* Allineato al trigger */
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
    display: flex; align-items: center; gap: 8px;
}
#btn-manage-clients:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Wrapper Select */
.client-selector-wrapper {
    position: relative;
    z-index: 50;
}

/* Trigger Bottone */
.client-trigger {
    height: 48px;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 4px 6px 4px 16px;
    
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
}

.client-trigger:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

/* Contenuto Select */
.client-info-box {
    display: flex; flex-direction: column; justify-content: center; line-height: 1.2;
}
.label-mini {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase; 
    letter-spacing: 0.08em; color: #94a3b8; margin-bottom: 2px;
}
#header-current-client {
    font-size: 0.9rem; font-weight: 700; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}

/* Icona Freccia Rotante */
.trigger-icon-box {
    width: 32px; height: 32px;
    background: #f8fafc;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #64748b;
    border: 1px solid #f1f5f9;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.client-selector-wrapper.open .trigger-icon-box {
    transform: rotate(180deg);
    background: #eff6ff; color: var(--primary); border-color: #dbeafe;
}

/* Menu Dropdown */
.client-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 
        0 20px 40px -5px rgba(0,0,0,0.1), 
        0 8px 16px -6px rgba(0,0,0,0.05);
    
    padding: 8px;
    z-index: 9999;
    
    opacity: 0; visibility: hidden; 
    transform: translateY(-10px) scale(0.98);
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.client-selector-wrapper.open .client-dropdown-menu {
    opacity: 1; visibility: visible; transform: translateY(0) scale(1);
}
.client-option {
    display: flex; align-items: center; gap: 12px; padding: 10px;
    border-radius: 8px; cursor: pointer; transition: background 0.2s;
}
.client-option:hover { background: #f1f5f9; }
.client-option.selected { background: #eff6ff; border: 1px solid #dbeafe; }


/* --- 4. BADGES & STATI --- */

/* Badge "Operativo" (Verde Pulsante) */
.badge-pay-status {
    background: #ecfdf5;
    color: #059669;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    border: 1px solid #d1fae5;
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.05);
    transition: all 0.2s;
}
.badge-pay-status::before {
    content: ''; width: 6px; height: 6px; 
    background: #10b981; border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    animation: pulseGreen 2s infinite;
}
@keyframes pulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Badge "System Operational" (Luxury Chip - legacy) */
.badge-status {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 16px; border-radius: 100px;
    background: white; border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-muted);
}
.badge-status.online {
    color: var(--text-main); border-color: rgba(16, 185, 129, 0.2);
    background: linear-gradient(to bottom, #ffffff, #f0fdf4);
}


/* --- 5. COMPONENTI & UTILITY --- */

/* Glass Panel Utility */
.glass-panel {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

/* Card Provider Solida */
.provider-row-solid {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
    transform: translateZ(0); /* Rendering nitido */
}
.provider-row-solid:hover {
    border-color: var(--primary);
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.08);
}

/* Icone Provider */
.provider-info { display: flex; align-items: center; gap: 16px; }
.provider-icon {
    width: 48px; height: 48px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; border: 1px solid #f1f5f9;
}
.provider-text h4 { margin: 0; font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.provider-text span { font-size: 0.8rem; color: #64748b; }

/* Bottoni */
.btn-pill {
    padding: 6px 16px; border-radius: 100px;
    font-size: 0.75rem; font-weight: 600;
    border: 1px solid #e2e8f0; background: white; color: var(--text-muted);
    cursor: pointer; transition: 0.2s;
}
.btn-pill:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }

.btn-solid-black {
    background: #0f172a; color: white; padding: 8px 20px;
    border-radius: 100px; font-size: 0.85rem; font-weight: 600;
    border: none; cursor: pointer; transition: transform 0.1s;
}
.btn-solid-black:hover { background: #1e293b; }
.btn-solid-black:active { transform: scale(0.96); }

/* Task List */
.task-item {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px; background: #f8fafc; border-radius: 8px; border: 1px solid transparent;
    margin-bottom: 8px; cursor: pointer; transition: 0.2s;
}
.task-item:hover { background: white; border-color: #cbd5e1; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.task-item.done { text-decoration: line-through; opacity: 0.6; }
.task-check { width: 18px; height: 18px; border: 2px solid #cbd5e1; border-radius: 5px; flex-shrink: 0; margin-top: 2px; }
.task-item.done .task-check { background: #10b981; border-color: #10b981; }

/* Utility Classes */
.mb-3 { margin-bottom: 15px; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }

/* --- HEADER BRANDING UNIFICATO --- */

.header-brand-group {
    display: flex;
    flex-direction: column; /* Impila Logo e Testo verticalmente */
    justify-content: center;
    gap: 4px; /* Spazio tra logo e indicatore */
}

/* Stile del Logo */
.header-logo {
    height: 32px; /* Altezza fissa per coerenza */
    width: auto;
    object-fit: contain;
    display: block;
}

/* Indicatore della Pagina (Subito sotto) */
.page-indicator {
    font-family: var(--font-body, sans-serif);
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b; /* Slate-500 */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Opzionale: un pallino colorato prima del nome pagina */
.page-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: var(--primary, #4f46e5);
    border-radius: 50%;
    opacity: 0.5;
}