/* --- css/components.css (Versione per Bootstrap) --- */

/* --- FORM & INPUT --- */
/* Rinominato per non conflittare con l'input-group nativo di Bootstrap */
.input-group-custom {
    position: relative;
    width: 100%;
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--neon-cyan);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-input {
    width: 100%;
    padding: 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.form-input:focus {
    background: var(--bg-surface);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px var(--orb-glow);
    outline: none;
}

/* --- BOTTONI GLOBALI --- */
/* Usiamo la stessa classe di Bootstrap, ma forziamo il tuo stile neon */
.btn-primary {
    width: 100%;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-cyan)) !important;
    color: #ffffff !important;
    padding: 16px;
    border: none !important;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--orb-glow);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--orb-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* --- LINK --- */
.link-text {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
}

.link-text:hover {
    color: var(--neon-cyan);
}

/* --- TOGGLE PASSWORD E REGOLE (Invariati) --- */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper .form-input {
    padding-right: 45px; 
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s ease;
    font-size: 1rem;
}

.toggle-password:hover {
    color: var(--neon-cyan);
}

.password-rules {
    list-style: none;
    margin-top: -10px;
    margin-bottom: 20px;
    font-size: 0.75rem;
    color: var(--text-dim);
    background: var(--input-bg);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    padding-left: 12px; /* Aggiunto per fixare il padding delle liste di Bootstrap */
}

.password-rules li {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.password-rules li:last-child {
    margin-bottom: 0;
}

.password-rules li i {
    font-size: 0.7rem;
    width: 12px;
    text-align: center;
}

.password-rules li.invalid {
    color: var(--text-dim);
}

.password-rules li.invalid i::before {
    content: "\f111"; 
    font-weight: 400; 
}

.password-rules li.valid {
    color: #22c55e;
    font-weight: 600;
}

.password-rules li.valid i::before {
    content: "\f00c"; 
    font-weight: 900; 
}

/* --- LOADER K-UBE GLOBAL --- */
.kube-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
}

.kube-loader-box {
    background: var(--bg-surface);
    padding: 40px 60px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3), 0 0 30px var(--orb-glow);
    text-align: center;
    transform: scale(0.9);
    animation: popIn 0.3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { to { transform: scale(1); } }
/* ============================================================================
   COLLEGAMENTI (Mandati Condivisi) + editor regole riusato fuori da RuleBuilder.
   Le pagine nuove non hanno CSS scoped: qui le classi comuni in versione GLOBALE.
   Le pagine esistenti hanno le proprie versioni scoped, che vincono per
   specificita' -> nessuna regressione. Hex hardcoded (design system "slate").
   ============================================================================ */

/* utility slate + badge senza style inline (es. "Passo X di 3") */
.bg-slate-50 { background-color: #f8fafc; }
.border-slate-100 { border-color: #f1f5f9; }
.border-slate-200 { border-color: #e2e8f0; }
.badge.bg-slate-100 { background-color: #f1f5f9; color: #475569; }

/* tabelle k-table */
.k-table th { border-bottom: 1px solid #e2e8f0; }
.k-table td { padding: 16px 12px; border-bottom: 1px solid #f1f5f9; transition: background-color .2s; }
.k-table tbody tr:last-child td { border-bottom: none; }
.k-table-row:hover td { background-color: #f8fafc; }
.k-row-disattivato td { background-color: #f8fafc !important; opacity: .75; }
.k-row-disattivato:hover td { opacity: .9; background-color: #f1f5f9 !important; }
.empty-state-icon { width: 70px; height: 70px; background: #f1f5f9; color: #94a3b8; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.8rem; }

/* bottoni comuni */
.btn-custom-cyan { background: #0ea5e9 !important; border: none !important; color: #fff !important; transition: all .2s ease; }
.btn-custom-cyan:hover:not(:disabled) { background: #0284c7 !important; transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(14,165,233,.3) !important; }
.btn-action-edit { background: #fff; color: #0ea5e9; border: 1px solid #e2e8f0; border-radius: 8px; font-weight: 700; font-size: .8rem; padding: 6px 12px; transition: all .2s; }
.btn-action-edit:hover { background: #0ea5e9; border-color: #0ea5e9; color: #fff; transform: translateY(-1px); }
.btn-back { transition: all .2s; }
.btn-back:hover { background-color: #f1f5f9; transform: translateX(-2px); }
.btn-action-cancel { color: #475569 !important; background: #fff; transition: all .2s; }
.btn-action-cancel:hover:not(:disabled) { background: #f8fafc; color: #1e293b !important; }

/* sticky action bar (pagina regole collegamento) */
.action-bar-bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background-color: rgba(255,255,255,.95) !important; backdrop-filter: blur(10px); border-radius: 0 !important; }
@media (min-width: 992px) { .action-bar-bottom { left: 260px; } }

/* editor regole (rb-*) - replica globale di RuleBuilder.razor.css senza ::deep */
.rb-root { width: 100%; font-family: 'Inter', 'Segoe UI', sans-serif; }
.rb-add-bar { display: flex; gap: 16px; flex-wrap: wrap; }
.rb-btn-add { border: 2px dashed #cbd5e1; border-radius: 16px; padding: 20px; cursor: pointer; flex: 1; min-width: 250px; text-align: center; transition: all .2s ease; box-shadow: 0 4px 6px -1px rgba(0,0,0,.02); background: #fff; }
.rb-btn-add:hover { border-color: #0ea5e9; background-color: #f8fafc; transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(14,165,233,.1); }
.rb-btn-add-icon { font-size: 24px; display: block; margin-bottom: 8px; }
.rb-btn-add-label { font-size: 14px; text-transform: uppercase; letter-spacing: .5px; }

.rb-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; margin-bottom: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03); transition: transform .2s, box-shadow .2s; }
.rb-card:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,.08); }
.rb-card-disabled { opacity: .6; filter: grayscale(1); }
.rb-card-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; cursor: pointer; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid #f1f5f9; }
.rb-card-header:hover { background: #f8fafc; border-radius: 16px 16px 0 0; }
.rb-card-header-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; color: #1e293b; font-weight: 700; font-size: 1.1rem; }
.rb-card-header-right { display: flex; gap: 8px; align-items: center; }
.rb-card-arrow { font-size: 18px; color: #94a3b8; flex-shrink: 0; }
.rb-card-body { padding: 16px 20px 24px; background-color: #f8fafc; border-radius: 0 0 16px 16px; }

.rb-group { padding: 16px; border-radius: 12px; margin-bottom: 12px; border: 1px solid #e2e8f0; background: #fff; }
.rb-group-depth-0 { border-left: 4px solid #3b82f6; }
.rb-group-depth-1 { border-left: 4px solid #8b5cf6; background: #faf5ff; }
.rb-group-depth-2 { border-left: 4px solid #ec4899; background: #fdf2f8; }
.rb-group-depth-3 { border-left: 4px solid #f59e0b; background: #fffbeb; }
.rb-group-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; border-bottom: 1px dashed #e2e8f0; padding-bottom: 8px; }
.rb-group-header-left { display: flex; align-items: center; gap: 8px; }
.rb-group-label { font-size: 12px; color: #64748b; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.rb-group-actions { display: flex; gap: 8px; }
.rb-cond-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.rb-logic-divider { text-align: center; font-size: 11px; color: #94a3b8; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; padding: 4px 0; }
.rb-logic-toggle { padding: 4px 14px; border-radius: 6px; border: none; color: #fff; font-weight: 800; font-size: 12px; cursor: pointer; letter-spacing: 1px; box-shadow: 0 2px 4px rgba(0,0,0,.1); }
.rb-logic-and { background: #3b82f6; }
.rb-logic-or { background: #8b5cf6; }
.rb-action-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; box-shadow: 0 2px 4px rgba(0,0,0,.02); }
.rb-mod-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.rb-mod-eq { color: #94a3b8; font-size: 14px; font-weight: 800; }
.rb-premio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.rb-select, .rb-input { background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 12px; color: #1e293b; font-size: 14px; font-weight: 500; outline: none; transition: all .2s; box-shadow: inset 0 1px 2px rgba(0,0,0,.02); }
.rb-select:focus, .rb-input:focus { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
.rb-select-prop { flex: 1 1 200px; min-width: 180px; }
.rb-select-op { flex: 0 0 auto; min-width: 140px; font-weight: 700; color: #334155; background-color: #f8fafc; }
.rb-select-val { min-width: 100px; }
.rb-input-sm { width: 120px; }
.rb-input-full { width: 100%; }
.rb-input-inline { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; color: #1e293b; font-size: 16px; font-weight: 700; outline: none; flex: 1; transition: border .2s; }
.rb-input-inline:hover { border-color: #e2e8f0; background: #fff; }
.rb-input-inline:focus { border-color: #0ea5e9; background: #fff; box-shadow: 0 0 0 3px rgba(14,165,233,.1); }
.rb-row-2col { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.rb-between { display: flex; gap: 8px; align-items: center; }
.rb-between-sep { color: #94a3b8; font-size: 14px; font-weight: 600; }
.rb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rb-tag { padding: 4px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; border: 1px solid #e2e8f0; cursor: pointer; transition: all .2s; background: #fff; color: #475569; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.rb-tag:hover { border-color: #cbd5e1; background: #f8fafc; color: #1e293b; }
.rb-tag-active { background: #0ea5e9 !important; color: #fff !important; border-color: #0ea5e9 !important; box-shadow: 0 2px 4px rgba(14,165,233,.2) !important; }
/* elenchi lunghi di valori (es. nazioni): ricerca + area scrollabile */
.rb-tags-box { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 240px; }
.rb-tags-search { width: 100%; max-width: 340px; }
.rb-tags-scroll { max-height: 170px; overflow-y: auto; padding: 2px; }
.rb-tags-hint { font-size: 12px; color: #94a3b8; }
.rb-label { display: block; font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.rb-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; box-shadow: 0 2px 4px rgba(0,0,0,.1); }
.rb-badge-red { background: #ef4444; }
.rb-badge-blue { background: #3b82f6; }
.rb-badge-green { background: #10b981; }
.rb-btn { border-radius: 8px; padding: 6px 14px; font-weight: 600; font-size: 13px; cursor: pointer; border: none; transition: all .2s; }
.rb-btn:hover { transform: translateY(-1px); }
.rb-btn-secondary { background: #fff; color: #475569; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 12px; font-size: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.rb-btn-secondary:hover { background: #f8fafc; color: #1e293b; }
.rb-btn-x { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.rb-btn-x:hover { background: #ef4444; color: #fff; }
.rb-btn-sm { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .2s; }
.rb-btn-sm:hover { background: #e2e8f0; }
.rb-btn-sm-on { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.rb-btn-sm-on:hover { background: #16a34a; color: #fff; }
.rb-btn-sm-off { background: #f1f5f9; color: #64748b; }
.rb-btn-sm-danger { background: #fef2f2; color: #ef4444; border-color: #fecaca; }
.rb-btn-sm-danger:hover { background: #ef4444; color: #fff; }
