/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%; /* Garante que ocupem 100% da altura da viewport */
    margin: 0;
    padding: 0;
}

:root {
    /* Paleta de cores roxa moderna */
    --primary-purple: #513998;
    --dark-purple: #3d2b73;
    --light-purple: #9d8abf;
    --accent-purple: #7c5dc7;
    --background-dark: #0a0a0f;
    --card-background: #1a1a25;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #6b6b7d;
    --accent-secondary: #513998;
    --error-red: #ff4757;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --shadow-glow: rgba(81, 57, 152, 0.3);
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary-purple), var(--accent-purple));
    --gradient-card: linear-gradient(145deg, var(--card-background), rgba(26, 26, 37, 0.8));
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative; /* Necessário para posicionamento absoluto de elementos filhos */
    overflow-y: auto; /* Permite rolagem vertical SOMENTE se o conteúdo exceder */
}

.market4u {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Nova abordagem para o layout principal */
.container {
    min-height: 100vh;
    display: flex; /* Mantido para centralizar o wrapper, mas flex-grow agora é chave */
    align-items: center; /* Centraliza horizontalmente o login-wrapper */
    justify-content: center; /* Centraliza verticalmente o login-wrapper */
    position: relative;
    padding: 20px;
    flex-direction: column; /* Organiza logo e card em coluna */
}

.login-header {
    text-align: center;
    margin-bottom: 30px; /* Mantém um bom espaçamento abaixo do logo */
    /* Removido posicionamento aqui, será apenas um item flex */
}

.login-header .logo {
    height: 150px; /* Seu tamanho desejado */
    width: 150px;  /* Seu tamanho desejado */
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(81, 57, 152, 0.3));
    transition: transform 0.3s ease;
}

.login-header .logo:hover {
    transform: scale(1.05);
}

/* O wrapper agora controla a centralização do card */
.login-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Ajustes para o wrapper para que ele se ajuste no espaço restante */
    flex-grow: 1; /* Permite que ele cresça e ocupe o espaço disponível */
    justify-content: center; /* Centraliza o card dentro do wrapper */
    width: 100%; /* Ocupa a largura total do container */
}

.login-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 40px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(81, 57, 152, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    /* Removemos margens automáticas para centralizar com Flexbox no wrapper */
    margin: 0; 
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-primary);
    opacity: 0.3;
}

/* Título do login */
.login-title {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 40px;
    letter-spacing: -0.5px;
}

/* Mensagem de erro */
.error-message {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--error-red);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    animation: shake 0.5s ease-in-out;
}

.error-message p {
    color: var(--error-red);
    font-size: 14px;
    text-align: center;
    margin: 0;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
}

/* Formulário */
.login-form {
    margin-bottom: 24px;
}

.form-group p {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-purple);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 0 0 3px rgba(81, 57, 152, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.form-group input[type="text"]::placeholder,
.form-group input[type="password"]::placeholder {
    color: var(--text-muted);
}

/* Botão de login com tema roxo */
.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(81, 57, 152, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(81, 57, 152, 0.4);
}

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

.btn-text {
    position: relative;
    z-index: 2;
}

.btn-effect {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.login-btn:hover .btn-effect {
    left: 100%;
}

/* Links do rodapé */
.footer-links {
    text-align: center;
}

.forgot-password {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
    position: relative;
}

.forgot-password:hover {
    color: var(--primary-purple);
}

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

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

/* Responsividade */
@media (max-width: 480px) {
    .header {
        padding: 16px 20px;
    }
    
    .app-icon {
        width: 40px;
        height: 40px;
    }
    
    .login-card {
        padding: 32px 24px;
        margin: 20px;
    }
    
    .login-title {
        font-size: 28px;
    }
    
    .form-group input[type="text"],
    .form-group input[type="password"] {
        padding: 14px 16px;
    }
    
    .container {
        padding: 20px; /* Garante que o padding lateral ainda funcione */
    }
}

/* Animação de entrada */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}