/* Gamified Auth Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
    animation: modalFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(15px);
    }
}

.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    color: var(--text-primary);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8) translateY(50px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 100px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        #667eea 0%, 
        #764ba2 25%, 
        #f093fb 50%, 
        #f5576c 75%, 
        #4facfe 100%);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 2.5rem 2.5rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100px;
    height: 2px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.modal-header h2 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #a8a6ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: var(--secondary-gradient);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.3);
}

.modal-body {
    padding: 2.5rem;
}

/* Gamified Auth Form Styles */
.auth-form {
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    z-index: 1;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.input-with-icon input {
    width: 100%;
    padding: 1.2rem 1.2rem 1.2rem 3.2rem;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 15px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 4px 15px rgba(0, 0, 0, 0.1);
}

.input-with-icon input::placeholder {
    color: var(--text-tertiary);
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    box-shadow: 
        0 0 0 3px rgba(102, 126, 234, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.input-with-icon input:focus + i {
    color: var(--primary-color);
    transform: scale(1.1);
}

.input-with-icon .password-toggle {
    position: absolute;
    right: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.input-with-icon .password-toggle:hover {
    background: var(--primary-gradient);
    color: white;
    transform: scale(1.1);
}

.btn-full {
    width: 100%;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Gamified Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.checkbox:hover {
    color: white;
    transform: translateX(5px);
}

.checkbox input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    margin-right: 0.8rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.checkbox input:checked + .checkmark {
    background: var(--primary-gradient);
    border-color: transparent;
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.checkbox input:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.forgot-password::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.forgot-password:hover {
    color: var(--secondary-color);
    transform: translateY(-1px);
}

.forgot-password:hover::after {
    width: 100%;
}

/* Gamified Password Strength */
.password-strength {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.strength-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.8rem;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.strength-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent);
    animation: shimmer 2s infinite;
}

.strength-fill[data-strength="0"] {
    width: 0%;
    background: linear-gradient(90deg, #ff4757, #ff6b81);
}

.strength-fill[data-strength="1"] {
    width: 25%;
    background: linear-gradient(90deg, #ff4757, #ff9f43);
}

.strength-fill[data-strength="2"] {
    width: 50%;
    background: linear-gradient(90deg, #ff9f43, #feca57);
}

.strength-fill[data-strength="3"] {
    width: 75%;
    background: linear-gradient(90deg, #feca57, #2ed573);
}

.strength-fill[data-strength="4"] {
    width: 100%;
    background: linear-gradient(90deg, #2ed573, #1dd1a1);
    box-shadow: 0 0 20px rgba(46, 213, 115, 0.3);
}

.strength-text {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.strength-fill[data-strength="0"] + .strength-text { color: #ff4757; }
.strength-fill[data-strength="1"] + .strength-text { color: #ff9f43; }
.strength-fill[data-strength="2"] + .strength-text { color: #feca57; }
.strength-fill[data-strength="3"] + .strength-text { color: #2ed573; }
.strength-fill[data-strength="4"] + .strength-text { 
    color: #1dd1a1; 
    text-shadow: 0 0 10px rgba(29, 209, 161, 0.5);
}

/* Gamified Auth Divider */
.auth-divider {
    position: relative;
    text-align: center;
    margin: 2.5rem 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
}

.auth-divider span {
    background: var(--card-bg);
    padding: 0.5rem 1.5rem;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

/* Gamified Social Auth */
.social-auth {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.social-btn {
    padding: 1rem;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: 15px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.social-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transition: left 0.5s ease;
}

.social-btn:hover::before {
    left: 100%;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
}

.social-btn i {
    font-size: 1.4rem;
    transition: transform 0.3s ease;
}

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

.google-btn:hover {
    border-color: #DB4437;
    box-shadow: 0 10px 25px rgba(219, 68, 55, 0.3);
    color: #DB4437;
}

.apple-btn:hover {
    border-color: #A2AAAD;
    box-shadow: 0 10px 25px rgba(162, 170, 173, 0.3);
    color: #A2AAAD;
}

.github-btn:hover {
    border-color: #6cc644;
    box-shadow: 0 10px 25px rgba(108, 198, 68, 0.3);
    color: #6cc644;
}

/* Gamified Auth Switch */
.auth-switch {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
}

.auth-switch a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.auth-switch a:hover {
    color: var(--secondary-color);
}

.auth-switch a:hover::after {
    width: 100%;
}

/* Gamified Success Modal */
.success-modal {
    text-align: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.success-modal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        #667eea,
        #764ba2,
        #f093fb,
        #f5576c,
        #4facfe,
        #667eea
    );
    animation: rotate 4s linear infinite;
    opacity: 0.1;
}

.success-icon {
    width: 100px;
    height: 100px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 2rem;
    animation: successPop 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
    box-shadow: 
        0 15px 35px rgba(102, 126, 234, 0.4),
        0 0 50px rgba(102, 126, 234, 0.2);
    position: relative;
    z-index: 1;
}

@keyframes successPop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.1) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.success-modal h2 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff, #a8a6ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
}

.success-modal p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

/* Gamified Form Validation */
.form-group.error input {
    border-color: #ff4757;
    box-shadow: 
        0 0 0 3px rgba(255, 71, 87, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: shake 0.5s ease-in-out;
}

.form-group.success input {
    border-color: #2ed573;
    box-shadow: 
        0 0 0 3px rgba(46, 213, 115, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.error-message {
    color: #ff6b81;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-weight: 600;
    display: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 107, 129, 0.1);
    border-radius: 8px;
    border-left: 3px solid #ff6b81;
}

.form-group.error .error-message {
    display: block;
    animation: slideDown 0.3s ease;
}

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

/* Additional Animations */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

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

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Achievement Unlock Effect */
.achievement-unlock {
    animation: achievementPop 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Level Up Effect */
.level-up {
    position: relative;
    overflow: hidden;
}

.level-up::after {
    content: 'LEVEL UP!';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: var(--primary-gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: levelUp 1s ease-out;
}

@keyframes levelUp {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* XP Gain Effect */
.xp-gain {
    position: relative;
}

.xp-gain::before {
    content: '+50 XP';
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--secondary-gradient);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: 700;
    animation: xpFloat 2s ease-out forwards;
}

@keyframes xpFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px) scale(0.8);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-width: none;
    }
    
    .modal-header {
        padding: 2rem 2rem 1rem;
    }
    
    .modal-body {
        padding: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .social-auth {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .social-btn {
        flex-direction: row;
        justify-content: center;
        padding: 1.2rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .success-modal {
        padding: 2rem 1.5rem;
    }
    
    .success-icon {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .modal-header h2 {
        font-size: 1.6rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .input-with-icon input {
        padding: 1rem 1rem 1rem 2.8rem;
    }
    
    .success-modal h2 {
        font-size: 1.8rem;
    }
}