/* ============================================
   SISTEMA UI PERSONALIZZAZIONE PERSONAGGIO
   ============================================ */

.cosmetics-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 30, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.95);
        opacity: 0;
    }
}

.customization-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ffff;
    border-radius: 15px;
    padding: 20px;
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5), inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.customization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #00ffff;
}

.customization-header h2 {
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    margin: 0;
    font-size: 28px;
}

.close-btn {
    background: rgba(255, 0, 0, 0.3);
    border: 2px solid #ff0000;
    color: #ff0000;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 0, 0, 0.6);
    transform: rotate(90deg);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
}

/* ============================================
   CONTENUTO PERSONALIZZAZIONE
   ============================================ */

.customization-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 20px;
}

/* ----- SEZIONE ANTEPRIMA ----- */

.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.character-preview {
    background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-radius: 15px;
    padding: 20px;
    min-height: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#preview-canvas {
    max-width: 100%;
    height: auto;
}

.preview-info {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    padding: 15px;
}

.preview-info h3 {
    color: #00ffff;
    margin: 0 0 15px 0;
    text-align: center;
}

.stats-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    color: #a0deea;
    font-size: 14px;
}

.stat-row span:first-child {
    color: #00ffff;
    font-weight: bold;
}

.stat-row span:last-child {
    color: #ffff00;
    font-weight: bold;
}

/* ----- SEZIONE CATEGORIE ----- */

.categories-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.category-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.category-btn {
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid rgba(0, 255, 255, 0.4);
    color: #a0deea;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.category-btn:hover,
.category-btn.active {
    background: rgba(0, 255, 255, 0.3);
    border-color: #00ffff;
    color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6), inset 0 0 10px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.cosmetics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

/* ----- ITEM COSMICI ----- */

.cosmetic-item {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cosmetic-item:hover {
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.15);
    transform: translateY(-5px);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.cosmetic-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.cosmetic-item.selected {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6), inset 0 0 10px rgba(0, 255, 0, 0.2);
}

.cosmetic-item-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.cosmetic-emoji {
    font-size: 32px;
    margin-bottom: 5px;
}

.cosmetic-name {
    color: #a0deea;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
    word-break: break-word;
}

.cosmetic-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.8;
}

.cosmetic-color {
    width: 30px;
    height: 30px;
    margin: 8px auto;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.cosmetic-info {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.unlock-requirement {
    font-size: 11px;
    color: #ffaa00;
}

.req-type {
    color: #a0deea;
    font-size: 10px;
}

.req-cost {
    font-weight: bold;
    color: #ffff00;
}

.cosmetic-action-btn {
    background: rgba(0, 150, 255, 0.3);
    border: 1px solid #0096ff;
    color: #00ffff;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.cosmetic-action-btn:hover {
    background: rgba(0, 150, 255, 0.6);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
}

/* ----- INFO SBLOCCO ----- */

.unlock-info {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 200, 0, 0.4);
    border-radius: 10px;
    padding: 15px;
    grid-column: 1 / -1;
}

.unlock-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.level-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #000;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 0 5px rgba(255, 200, 0, 0.5);
}

.progress-bar {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 200, 0, 0.4);
    border-radius: 10px;
    height: 25px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #00ff00, #00ffff, #0096ff);
    height: 100%;
    transition: width 0.5s ease;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
}

.progress-text {
    color: #a0deea;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
}

/* ----- PULSANTI AZIONE ----- */

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    grid-column: 1 / -1;
}

.btn {
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #00ff00, #00ffff);
    color: #000;
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.btn-secondary {
    background: rgba(100, 150, 255, 0.2);
    color: #00ffff;
    border-color: #0096ff;
    box-shadow: 0 0 10px rgba(0, 150, 255, 0.4);
}

.btn-secondary:hover {
    background: rgba(100, 150, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.6);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .customization-content {
        grid-template-columns: 1fr;
    }

    .category-buttons {
        grid-template-columns: repeat(3, 1fr);
    }

    .cosmetics-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 600px) {
    .customization-container {
        width: 95%;
        padding: 15px;
    }

    .customization-header h2 {
        font-size: 20px;
    }

    .category-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .cosmetics-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* ============================================
   SCROLLBAR PERSONALIZZATA
   ============================================ */

.cosmetic-item::-webkit-scrollbar,
.customization-container::-webkit-scrollbar {
    width: 10px;
}

.cosmetic-item::-webkit-scrollbar-track,
.customization-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.cosmetic-item::-webkit-scrollbar-thumb,
.customization-container::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 10px;
}

.cosmetic-item::-webkit-scrollbar-thumb:hover,
.customization-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.8);
}

/* ============================================
   SISTEMA UPLOAD FACCIA PERSONALIZZATA
   ============================================ */

.face-customization-container {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    margin: 0 auto;
}

.face-customization-container h3 {
    color: #00ffff;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.face-description {
    color: #a0deea;
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.face-upload-area {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.upload-btn, .remove-btn {
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid;
    font-size: 14px;
}

.upload-btn {
    background: linear-gradient(135deg, #00ff00, #00ffff);
    color: #000;
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.6);
}

.remove-btn {
    background: rgba(255, 0, 0, 0.2);
    color: #ff6666;
    border-color: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}

.remove-btn:hover {
    background: rgba(255, 0, 0, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.face-preview-container {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 255, 0.2);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.face-preview-container h4 {
    color: #00ffff;
    margin-bottom: 15px;
    font-size: 16px;
}

#face-preview-box {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(0, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.face-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.face-preview-placeholder {
    color: #666;
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

.face-info {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
}

.face-info p {
    color: #a0deea;
    margin: 5px 0;
    font-size: 13px;
}

.face-info strong {
    color: #00ffff;
}
