/* Estilos do Sistema de Autenticação */

/* Header de Autenticação */
.auth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    background: linear-gradient(135deg, #a8d8ea 0%, #f8c8dc 50%, #b8e0f6 100%);
    color: #4a4a4a;
    border-radius: 25px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(168, 216, 234, 0.4), 0 4px 15px rgba(248, 200, 220, 0.3);
    gap: 20px;
    border: 3px solid rgba(255, 255, 255, 0.6);
}

.auth-header h1 {
    margin: 0;
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
}

.main-title {
    margin: 0;
    font-family: 'Fredoka One', cursive;
    font-size: 1.9rem;
    color: #5c4d7d;
    text-align: center;
    flex: 1;
    text-shadow: 
        1px 1px 0px #ffffff,
        2px 2px 4px rgba(92, 77, 125, 0.2);
    letter-spacing: 1px;
    -webkit-text-stroke: 0;
    paint-order: stroke fill;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auth-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

/* Responsividade para telas pequenas */
@media (max-width: 767px) {
    .auth-header {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
        text-align: center;
    }
    
    .auth-buttons {
        order: 1;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .header-right {
        order: 2;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .auth-btn, .ranking-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .level-display, .header-right .score-display {
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .auth-header {
        padding: 15px;
        gap: 12px;
    }
    
    .auth-buttons {
        gap: 8px;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .auth-btn, .ranking-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .level-display, .header-right .score-display {
        font-size: 11px;
        padding: 5px 10px;
    }
}

.login-btn {
    background: linear-gradient(135deg, #a8d8ea 0%, #88c9de 100%);
    color: #4a7c94;
    border: 2px solid rgba(255, 255, 255, 0.7);
    font-weight: 700;
    text-shadow: none;
    box-shadow: 0 4px 12px rgba(168, 216, 234, 0.5);
}

.login-btn:hover {
    background: linear-gradient(135deg, #88c9de 0%, #a8d8ea 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(168, 216, 234, 0.6);
}

.register-btn {
    background: linear-gradient(135deg, #f8c8dc 0%, #f5a8c6 100%);
    color: #8b5a6d;
    font-weight: 700;
    text-shadow: none;
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(248, 200, 220, 0.5);
}

.register-btn:hover {
    background: linear-gradient(135deg, #f5a8c6 0%, #f8c8dc 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(248, 200, 220, 0.6);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right .score-display {
    background: linear-gradient(135deg, #fff5f8 0%, #ffe4ec 100%);
    color: #d4789c;
    padding: 10px 18px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid #f8c8dc;
    box-shadow: 0 4px 12px rgba(248, 200, 220, 0.4);
    text-shadow: none;
}

.header-right .score-display .stars {
    display: flex;
    align-items: center;
    gap: 5px;
}

.level-display {
    background: linear-gradient(135deg, #e3f4fc 0%, #c5e8f7 100%);
    color: #5a9fc6;
    padding: 10px 18px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid #a8d8ea;
    box-shadow: 0 4px 12px rgba(168, 216, 234, 0.4);
    text-shadow: none;
}

.ranking-btn {
    background: linear-gradient(135deg, #dab8f3 0%, #c9a4e8 100%);
    color: #6b4d7d;
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(218, 184, 243, 0.5);
    text-shadow: none;
}

.ranking-btn:hover {
    background: linear-gradient(135deg, #c9a4e8 0%, #dab8f3 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 18px rgba(218, 184, 243, 0.6);
}

/* Informações do Usuário Logado */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.username {
    font-weight: 600;
    font-size: 16px;
}

.logout-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal de Autenticação */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.auth-modal {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease;
}

.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.auth-modal-header h2 {
    margin: 0;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.auth-modal-body {
    padding: 25px;
}

/* Formulário */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Seleção de Avatar */
.avatar-selection {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.avatar-option {
    width: 60px;
    height: 60px;
    border: 3px solid #E0E0E0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-option:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: #FFD700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
    transform: scale(1.1);
}

/* Botão de Submit */
.auth-submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

/* Link de Troca */
.auth-switch {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #E0E0E0;
}

.auth-switch p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Mensagens */
.auth-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.auth-message.show {
    transform: translateX(0);
}

.auth-message.success {
    background: #4CAF50;
}

.auth-message.error {
    background: #F44336;
}

/* Modal de Ranking */
.ranking-modal {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.ranking-header {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ranking-list {
    padding: 20px;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.ranking-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.ranking-position {
    font-size: 18px;
    font-weight: bold;
    margin-right: 15px;
    min-width: 30px;
}

.ranking-position.gold { color: #FFD700; }
.ranking-position.silver { color: #C0C0C0; }
.ranking-position.bronze { color: #CD7F32; }

.ranking-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
}

.ranking-info {
    flex: 1;
}

.ranking-username {
    font-weight: 600;
    margin-bottom: 5px;
}

.ranking-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #666;
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsividade */
@media (max-width: 768px) {
    .auth-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .auth-modal {
        width: 95%;
        margin: 10px;
    }
    
    .avatar-selection {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .avatar-option {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .auth-modal-body {
        padding: 20px 15px;
    }
    
    .avatar-selection {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== EDIÇÃO DE PERFIL ========== */

/* Botão pequeno de editar perfil no header */
.edit-profile-btn-small {
    background: linear-gradient(135deg, #f8c8dc 0%, #a8d8ea 100%);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.edit-profile-btn-small:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(168, 216, 234, 0.4);
}

/* Avatar clicável */
.user-avatar {
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(248, 200, 220, 0.5);
}

/* Modal de edição de perfil */
.edit-profile-modal {
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.edit-profile-modal .auth-modal-header h2 {
    font-size: 1.5rem;
}

/* Perfil atual */
.current-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #e0f4ff 0%, #fce4ec 100%);
    border-radius: 15px;
    border: 2px solid rgba(168, 216, 234, 0.4);
}

.current-avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #a8d8ea;
    box-shadow: 0 4px 15px rgba(168, 216, 234, 0.4);
    transition: all 0.3s ease;
}

.current-username {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: #5c4d7d;
}

/* Grid grande de avatares para edição */
.avatar-grid-large {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding: 10px;
    background: linear-gradient(135deg, #f5f5f5 0%, #fafafa 100%);
    border-radius: 15px;
    border: 2px dashed rgba(168, 216, 234, 0.5);
}

.avatar-grid-large .avatar-option {
    width: 55px;
    height: 55px;
    margin: 0 auto;
}

.avatar-grid-large .avatar-option:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(168, 216, 234, 0.4);
}

.avatar-grid-large .avatar-option.selected {
    border-color: #f8c8dc;
    box-shadow: 0 0 0 4px rgba(248, 200, 220, 0.5);
}

/* Botão de salvar perfil */
.edit-profile-btn {
    background: linear-gradient(135deg, #a8d8ea 0%, #f8c8dc 100%) !important;
    color: #5c4d7d !important;
    font-weight: 700;
    font-size: 1rem;
    border: 3px solid rgba(255, 255, 255, 0.6);
}

.edit-profile-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 216, 234, 0.5);
}

/* Dica de formulário */
.form-hint {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    font-style: italic;
}

/* Modal de edição de perfil - scroll */
.edit-profile-modal .auth-modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

/* Campos de senha */
.edit-profile-modal input[type="password"] {
    font-family: inherit;
}

/* Responsividade para edição de perfil */
@media (max-width: 600px) {
    .avatar-grid-large {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .avatar-grid-large .avatar-option {
        width: 50px;
        height: 50px;
    }
    
    .current-avatar-preview {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 400px) {
    .avatar-grid-large {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .avatar-grid-large .avatar-option {
        width: 45px;
        height: 45px;
    }
    
    .edit-profile-btn-small {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}