/* /css/screens/profile-screen.css */
/* [PHIÊN BẢN 12.0.0 - HỆ THỐNG TÙY CHỈNH AVATAR/BANNER & HIỆU ỨNG VIỀN NÂNG CAO] */

/* 1. Bố cục chính */
.profile-main-layout {
    display: flex;
    flex-direction: row;
    height: 100%;
    overflow: hidden;
    padding-bottom: 60px; /* Chừa chỗ cho Navbar (Giả sử cao 60px) */
    box-sizing: border-box;
}

/* 2. Cột Trái (Sidebar) */
.profile-sidebar {
    width: 340px;
    flex-shrink: 0;
    background: linear-gradient(to right, rgba(10, 0, 25, 0.98), rgba(15, 5, 40, 0.95));
    border-right: 1px solid rgba(168, 85, 247, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.6);
    z-index: 10;
    height: 100%;
    overflow-y: auto;
}

/* 2.1. Thẻ người chơi */
.player-card-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid rgba(168, 85, 247, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* 2.1.1. Ảnh nền Banner */
.player-banner-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: background-image 0.5s ease;
}

.player-banner-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Gradient tối dần về phía dưới */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(15, 5, 40, 0.8) 100%);
}

/* 2.1.2. Nội dung thẻ */
.player-card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
    text-align: center;
}

/* 2.1.3. Hệ thống Avatar */
.avatar-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.avatar-container:hover {
    transform: scale(1.05);
}

.avatar-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

/* Áp dụng cho cả khung viền chính và khung viền xem trước */
.avatar-border-overlay, .preview-avatar-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 2;
    transition: opacity 0.3s ease;
    /* Hiệu ứng mặc định (nếu không có hiệu ứng đặc biệt) */
    animation: subtleFloat 5s ease-in-out infinite;
}

@keyframes subtleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.player-level-badge {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-accent-gold, #FFD700);
    color: #000;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

/* 2.1.4. Thông tin chi tiết */
.player-info-details {
    width: 100%;
}

/* 2.2. Điều hướng dọc */
.profile-vertical-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-bottom: 1rem;
}

.profile-vertical-nav .tab-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.8rem 2rem;
    text-align: left;
    border-radius: 0;
    background: transparent;
    border: none;
}

.profile-vertical-nav .tab-btn i {
    margin-right: 1rem;
    font-size: 1.2rem;
    width: 25px;
}

.profile-vertical-nav .tab-btn.active {
    box-shadow: inset 5px 0 0 var(--color-accent-gold, #FFD700); 
    background: rgba(168, 85, 247, 0.3);
}


/* 3. Khu vực Chính (Content Area) */
.profile-content-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: transparent; /* Để Canvas hiển thị nền */
    height: 100%;
}

/* Cấu trúc Canvas */
.mushroom-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.mushroom-canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


/* 4. Nội dung Tab và Hiệu ứng Chiếu */
.tab-content-container {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    pointer-events: none; 
}

.tab-content {
    pointer-events: auto; 
    height: 100%;
}

/* 4.1. Vùng chiếu Danh hiệu */
.titles-projection-area {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 3rem;
    overflow-y: auto;
}

.titles-grid-projection {
    display: grid;
    grid-template-columns: repeat(3, 220px); 
    grid-template-rows: repeat(3, auto);
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

.title-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    border-radius: 12px;
    width: 220px; 
    background: rgba(60, 30, 10, 0.7);
    border: 1px solid var(--color-accent-gold, #FFD700);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4), inset 0 0 15px rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: scale(0.8) translateY(50px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#profile-tab-titles.active .title-card {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.title-icon {
    font-size: 3.5rem;
    color: var(--color-accent-gold, #FFD700);
    text-shadow: 0 0 20px var(--color-accent-gold, #FFD700);
}


/* 5. Thanh Năng Lượng (XP Bar) */
.xp-bar-container {
    position: relative;
    width: 100%;
    height: 25px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.3);
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6 0%, #00FFFF 100%);
    transition: width 0.5s ease-out;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.xp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        -45deg, transparent, transparent 10px,
        rgba(255, 255, 255, 0.3) 10px, rgba(255, 255, 255, 0.3) 20px
    );
    background-size: 200% 200%;
    animation: energyFlow 5s linear infinite;
}

@keyframes energyFlow {
    0% { background-position: 0 0; }
    100% { background-position: 200% 200%; }
}

.xp-bar-text {
    position: absolute;
    width: 100%;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    text-align: center;
    color: #FFFFFF;
    font-weight: bold;
    font-size: 0.85rem;
    text-shadow: 1px 1px 3px #000;
}

/* 6. Modal Tùy chỉnh Hồ sơ */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.profile-modal-overlay.active {
    display: flex;
}

.profile-modal-content {
    background: rgba(15, 5, 40, 0.95);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 15px;
    padding: 2rem;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 0 50px rgba(168, 85, 247, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.profile-modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
}
.profile-modal-close-btn:hover { opacity: 1; }

.profile-modal-title {
    font-size: 1.8rem;
    color: var(--color-accent-gold, #FFD700);
    margin-bottom: 2rem;
    text-align: center;
}

.customization-layout {
    display: flex;
    gap: 2rem;
}

/* 6.1. Khu vực Preview */
.customization-preview {
    flex-basis: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-avatar-container {
    position: relative;
    width: 150px;
    height: 150px;
}

.preview-avatar-image {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 85%; height: 85%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
}

/* 6.2. Khu vực Lựa chọn */
.customization-selection {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.customization-grid-container {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px;
}

.customization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
}

.customization-item {
    aspect-ratio: 1 / 1;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.customization-item img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.customization-item.banner-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.customization-item:hover {
    border-color: rgba(168, 85, 247, 0.6);
    transform: scale(1.05);
}

.customization-item.selected {
    border-color: var(--color-accent-gold, #FFD700);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.profile-modal-actions {
    margin-top: 2rem;
    text-align: center;
}

/* 7. [V12.0.0] Hiệu ứng Khung viền Nâng cao (Dành cho Gacha/Sự kiện) */

/* Hiệu ứng Vàng Rung động (Golden Pulse) */
.effect-golden-pulse {
    /* Ghi đè animation mặc định nếu có (dùng !important) */
    animation: goldenPulse 2.5s ease-in-out infinite !important;
}

@keyframes goldenPulse {
    0%, 100% {
        transform: scale(1);
        /* Sử dụng filter: drop-shadow() để tạo Glow cho PNG trong suốt */
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }
    50% {
        transform: scale(1.02);
        filter: drop-shadow(0 0 18px rgba(255, 215, 0, 1));
    }
}

/* Hiệu ứng Sấm sét (Lightning) */
.effect-lightning {
    animation: lightningFlash 5s infinite !important;
}

@keyframes lightningFlash {
    0%, 90%, 93%, 97% {
        /* Trạng thái bình thường */
        filter: brightness(1) drop-shadow(0 0 5px rgba(0, 255, 255, 0.3));
    }
    91%, 92%, 94%, 98% {
        /* Sáng rực đột ngột (Flash) */
        filter: brightness(2.5) drop-shadow(0 0 25px rgba(0, 255, 255, 1));
    }
}

/* Hiệu ứng Lửa Bùng Cháy*/
.effect-flaming-soul {
    animation: flamingPulse 2s ease-in-out infinite !important;
}

@keyframes flamingPulse {
    0%, 100% {
        filter: drop-shadow(0 0 6px rgba(255, 100, 0, 0.7));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(255, 0, 0, 1));
    }
}

/* 8. Responsive (Điều chỉnh cho Mobile) */
@media (max-width: 768px) {
    .profile-main-layout {
        flex-direction: column;
        overflow-y: auto;
        padding-bottom: 60px;
    }
    .profile-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(168, 85, 247, 0.3);
    }
    .profile-content-area {
        background: rgba(5, 5, 15, 0.9); /* Nền dự phòng khi ẩn Canvas */
        flex-grow: 1;
    }
    
    .mushroom-canvas-container {
        display: none;
    }
    
    .profile-vertical-nav {
        flex-direction: row;
        justify-content: space-around;
        flex-wrap: wrap;
    }
     .profile-vertical-nav .tab-btn {
        padding: 0.8rem 1rem;
        box-shadow: none;
     }

     /* Điều chỉnh Modal trên Mobile */
     .customization-layout {
        flex-direction: column;
     }
     .customization-preview {
        flex-basis: auto;
     }
}

@media (max-width: 1100px) {
    .titles-grid-projection {
        display: flex;
        flex-wrap: wrap;
    }
}

/* Ẩn tất cả các grid-container mặc định */
.customization-grid-container {
    display: none;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px; /* Giữ style cũ của bạn */
}

/* Chỉ hiện grid-container nào có class .active */
.customization-grid-container.active {
    display: block; /* Sửa 'block' thành 'grid' nếu bạn dùng grid layout cho container */
}
/* Tùy chỉnh item avatar trong lưới chọn */
.customization-item.avatar-item {
    border-radius: 50%; /* Bo tròn */
    padding: 5px; /* Thêm khoảng đệm nhỏ */
}

.customization-item.avatar-item img {
    border-radius: 50%; /* Bo tròn ảnh bên trong */
    object-fit: cover; /* Đảm bảo ảnh đầy khung */
    width: 100%;
    height: 100%;
}