/* --- CSS GLOBAL --- */
.randomizer-card {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05), 0 5px 15px rgba(0, 0, 0, 0.02);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.randomizer-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 0, 0, 0.03);
}

/* Tab Navigazione */
.nav-pills {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
    position: relative;
    z-index: 1;
}

.nav-pills .nav-link {
    cursor: pointer;
    color: #666;
    border-radius: 50px;
    padding: 10px 25px;
    font-weight: 500;
    margin: 0 5px;
    transition: color 0.3s ease;
    position: relative;
    z-index: 2;
    background: transparent !important;
}

.nav-pills .nav-link.active {
    color: #fff !important;
    font-weight: bold;
}

.nav-pill-slider {
    position: absolute;
    top: 0;
    left: 0;
    height: 44px;
    /* Matches the button height approx */
    background-color: #ffc107;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 0;
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.4);
    opacity: 0;
    /* Hidden until positioned */
}

/* Input Box */
.input-box {
    background: linear-gradient(to bottom right, #f8f9fa, #ffffff);
    border: 1px solid #eef0f2;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.01);
}

.input-box:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
    border-color: #dee2e6;
}

.form-label-custom {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #adb5bd;
    margin-bottom: 5px;
    display: block;
    letter-spacing: 0.5px;
}

/* ANIMAZIONI & ERRORI */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.is-invalid-shake {
    border-color: #dc3545 !important;
    background-color: #fff8f8;
    animation: shake 0.4s ease-in-out;
}

.btn-error-shake {
    animation: shake 0.4s ease-in-out;
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.text-error-shake {
    color: #dc3545 !important;
    animation: shake 0.4s ease-in-out;
    font-weight: bold;
}

/* Liste */
.player-list-box {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 15px;
}

.player-row {
    border-bottom: 1px solid #f0f0f0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
}

/* --- LAYOUT GIOCATORE --- */
.player-left {
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.player-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 10px;
}

/* Editable Fields */
.editable {
    cursor: text;
    border-bottom: 1px dashed transparent;
    transition: 0.2s;
    padding: 0 2px;
}

.editable:hover {
    border-bottom-color: #adb5bd;
    background-color: #f8f9fa;
}

.editable:focus {
    outline: none;
    background-color: #fff;
    border-bottom: 2px solid #ffc107;
    color: #000;
}

/* Checkbox Custom */
.player-check {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #ffc107;
    pointer-events: none;
}

/* Badge */
.badge-custom {
    font-size: 0.75em;
    padding: 4px 8px;
    border-radius: 6px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

.bg-link {
    background-color: #343a40;
    color: #fff;
    cursor: default;
    border: 1px solid #212529;
}

.bg-enemy {
    background-color: #fff5f5;
    color: #e03131;
    border: 1px solid #ffa8a8;
    cursor: default;
}

.unlink-btn {
    cursor: pointer;
    font-weight: bold;
    margin-left: 4px;
    font-size: 1.1em;
    padding: 0 4px;
    border-radius: 4px;
    line-height: 1;
    z-index: 10;
}

.unlink-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    color: white;
}

.bg-enemy .unlink-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #c92a2a;
}

/* Result Tags */
.res-tag {
    font-size: 0.7em;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 2px;
    vertical-align: middle;
    color: white;
}

.tag-link {
    background: #6c757d;
}

.tag-sep {
    background: #e03131;
}

/* Manual Mode Slots */
.manual-team-slot {
    background: white;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Risultato */
#result-area {
    background: linear-gradient(135deg, #fffcf5 0%, #ffffff 100%);
    border: 2px dashed #ffc107;
    border-radius: 15px;
    color: #333;
    min-height: 120px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.02);
}

.result-number {
    font-size: 4.5rem;
    color: #0d6efd;
    font-weight: 800;
    text-shadow: 2px 2px 8px rgba(13, 110, 253, 0.2);
    line-height: 1;
}

.result-winner {
    font-size: 3rem;
    font-weight: 800;
    color: #198754;
    text-shadow: 2px 2px 8px rgba(25, 135, 84, 0.2);
    line-height: 1.2;
}

@keyframes zoomIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animated-zoom-in {
    animation: zoomIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes fadeInUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.animated-fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Buttons Shadow Enhancement */
.btn-warning {
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
    transition: all 0.2s ease-in-out;
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(255, 193, 7, 0.4);
}

/* Actions Bar */
.actions-bar {
    background: #e9ecef;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    margin-bottom: 20px;
    gap: 5px;
}

.adv-toggle {
    font-size: 0.8em;
    color: #666;
    cursor: pointer;
    user-select: none;
}

.adv-toggle input {
    margin-right: 5px;
}

/* --- STILE INTERRUTTORE (SWITCH) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    vertical-align: middle;
    margin-right: 8px;
}

/* Nasconde la casella brutta originale */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Disegna la base dell'interruttore */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    /* Grigio quando spento */
    transition: .4s;
    border-radius: 34px;
    /* Lo rende rotondo */
}

/* Disegna il pallino bianco che si muove */
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* Quando lo accendi diventa Giallo/Oro */
input:checked+.slider {
    background-color: #ffc107;
}

/* Quando lo accendi sposta il pallino a destra */
input:checked+.slider:before {
    transform: translateX(20px);
}

/* --- STILE PESO (NOMI) - Look Ticket --- */
.bg-weight {
    /* Base comune */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: sans-serif;
    padding: 3px 8px;
    border-radius: 6px;
    /* Quadrato arrotondato */
    font-size: 0.8em;
    min-width: 35px;
    /* Larghezza fissa per allinearli */
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
    /* Effetto 3D leggero */
    margin-left: 6px;
    color: white;
    /* Testo sempre bianco per contrasto */
    background-color: #059669;
    /* Grigio di default */
}

.bg-weight:hover {
    filter: brightness(1.15);
    /* Lo rende leggermente più chiaro */
    color: #059669 !important;
    /* Forza il testo a rimanere bianco */
}

/* Icona Biglietto */
.bg-weight::before {
    content: "x";
    margin-right: 4px;
    font-size: 0.9em;
}

/* --- STILE SKILL (SQUADRE) - Look da Videogioco --- */
.bg-skill {
    /* Base comune */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: sans-serif;
    padding: 3px 8px;
    border-radius: 6px;
    /* Quadrato arrotondato */
    font-size: 0.8em;
    min-width: 35px;
    /* Larghezza fissa per allinearli */
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
    /* Effetto 3D leggero */
    margin-left: 6px;
    color: white;
    /* Testo sempre bianco per contrasto */
}

/* Icona Stella prima del numero */
.bg-skill::before {
    content: "★";
    margin-right: 3px;
    font-size: 0.9em;
    opacity: 0.9;
}

/* Classi per i colori dinamici (le useremo nel JS) */
.skill-low {
    background-color: #6c757d;
    border: 1px solid #495057;
}

/* Grigio (Scarso) */
.skill-mid {
    background-color: #f59e0b;
    border: 1px solid #d97706;
}

/* Arancio (Medio) */
.skill-high {
    background-color: #10b981;
    border: 1px solid #059669;
}

/* Verde (Forte) */
.skill-god {
    background-color: #8b5cf6;
    border: 1px solid #7c3aed;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* Viola (Top 10) */

/* FIX: Impedisce al badge di diventare bianco al passaggio del mouse */
.bg-skill.editable:hover {
    filter: brightness(1.15);
    /* Lo rende leggermente più chiaro */
    color: white !important;
    /* Forza il testo a rimanere bianco */
    cursor: pointer;
}

/* Mantiene il colore di sfondo corretto (sovrascrive il bianco generico) */
.skill-low:hover {
    background-color: #6c757d;
}

.skill-mid:hover {
    background-color: #f59e0b;
}

.skill-high:hover {
    background-color: #10b981;
}

.skill-god:hover {
    background-color: #8b5cf6;
}