.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.modal-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 25px;
    padding: 45px;
    max-width: 550px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateY(50px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.modal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00b894, #00cec9, #0984e3, #6c5ce7);
    animation: gradientMove 3s linear infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.avatar-setup-header {
    text-align: center;
    margin-bottom: 30px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    max-height: 500px;
    overflow: hidden;
}

.avatar-setup-header.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.warning-icon-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.warning-icon-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

.warning-icon {
    position: relative;
    z-index: 1;
    font-size: 40px;
    color: #fff;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: iconBounce 2s infinite;
}

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

.setup-title {
    color: white;
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: titleGlow 3s infinite alternate;
}

@keyframes titleGlow {
    0% {
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.3);
    }
    100% {
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 30px rgba(255, 255, 255, 0.5);
    }
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: badgeFloat 3s ease-in-out infinite;
}

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

.security-badge i {
    color: #ffd700;
    font-size: 16px;
}

.security-badge span {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.setup-description {
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
}

.warning-notice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    padding: 12px 20px;
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.4);
    animation: noticeShake 5s infinite;
}

@keyframes noticeShake {
    0%, 90%, 100% {
        transform: translateX(0);
    }
    92%, 96% {
        transform: translateX(-3px);
    }
    94%, 98% {
        transform: translateX(3px);
    }
}

.warning-notice i {
    color: #fff;
    font-size: 18px;
    animation: iconSpin 10s linear infinite;
}

@keyframes iconSpin {
    0%, 90% {
        transform: rotate(0deg);
    }
    92%, 98% {
        transform: rotate(10deg);
    }
    95% {
        transform: rotate(-10deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.warning-notice span {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.roblox-search-container {
    width: 100%;
}

.search-input-group {
    position: relative;
    margin-bottom: 20px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    z-index: 1;
}

#robloxUsername {
    width: 100%;
    padding: 18px 18px 18px 55px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#robloxUsername:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.2), 0 0 0 4px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

#robloxUsername::placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.search-results {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 10px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.search-result-item:last-child {
    margin-bottom: 0;
}

.result-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.search-result-item:hover .result-avatar {
    border-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
}

.result-info h4 {
    color: white;
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.result-info p {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-size: 12px;
}

.selected-character {
    text-align: center;
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.character-preview {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 25px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.character-preview::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

#selectedAvatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    animation: avatarZoom 0.5s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes avatarZoom {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.character-info {
    position: relative;
    z-index: 1;
}

.character-info h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: textFadeIn 0.6s ease-out 0.2s both;
}

@keyframes textFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.character-info p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    animation: textFadeIn 0.6s ease-out 0.3s both;
}

.character-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.confirm-btn, .search-again-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-width: 180px;
}

.confirm-btn i,
.search-again-btn i {
    font-size: 16px;
    transition: all 0.3s ease;
}

.confirm-btn span,
.search-again-btn span {
    position: relative;
    z-index: 2;
}

.confirm-btn::before,
.search-again-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.confirm-btn:hover::before,
.search-again-btn:hover::before {
    width: 300px;
    height: 300px;
}

.confirm-btn {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
    position: relative;
    z-index: 1;
}

.confirm-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 206, 201, 0.6);
}

.confirm-btn:hover i {
    transform: rotate(360deg) scale(1.2);
}

.confirm-btn:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.search-again-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.search-again-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.3);
}

.search-again-btn:hover i {
    transform: scale(1.2);
}

.search-again-btn:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .modal-container {
        padding: 35px 25px;
        margin: 20px;
        max-width: 95%;
    }
    
    .warning-icon-container {
        width: 70px;
        height: 70px;
    }
    
    .warning-icon {
        font-size: 35px;
    }
    
    .setup-title {
        font-size: 22px;
        letter-spacing: 1px;
    }
    
    .security-badge {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .setup-description {
        font-size: 14px;
    }
    
    .warning-notice {
        padding: 10px 16px;
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
    
    .warning-notice span {
        font-size: 12px;
    }
    
    #robloxUsername {
        padding: 15px 15px 15px 50px;
        font-size: 15px;
    }
    
    .search-results {
        max-height: 250px;
    }
    
    .result-avatar {
        width: 40px;
        height: 40px;
    }
    
    #selectedAvatar {
        width: 90px;
        height: 90px;
    }
    
    .character-info h3 {
        font-size: 20px;
    }
    
    .character-actions {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .confirm-btn, .search-again-btn {
        width: 100%;
        min-width: unset;
        padding: 16px 20px;
        font-size: 12px;
        letter-spacing: 1px;
    }
    
    .confirm-btn i,
    .search-again-btn i {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        padding: 25px 20px;
    }
    
    .setup-title {
        font-size: 20px;
    }
    
    .warning-icon-container {
        width: 60px;
        height: 60px;
    }
    
    .warning-icon {
        font-size: 30px;
    }
}
