/* Reset Básico */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Alterado de height para min-height para permitir scroll em ecrãs pequenos */
    min-height: 100vh; 
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: #334155;
    /* Adicionado padding para quando a altura do ecrã for pequena */
    padding: 20px 0; 
}

.login-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0 20px; /* Margem lateral de segurança */
}

.login-box {
    background: white;
    padding: 40px 35px;
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: padding 0.3s ease; /* Suavizar transição de tamanho */
}

.logo {
    width: 120px;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.login-box h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 30px;
    color: #1e293b;
    letter-spacing: -0.5px;
}

.login-box input {
    width: 100%;
    padding: 14px;
    margin-top: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
    color: #334155;
    transition: all 0.2s ease;
}

.login-box input::placeholder {
    color: #94a3b8;
}

.login-box input:focus {
    outline: none;
    background: white;
    border-color: #334155;
    box-shadow: 0 0 0 3px rgba(51, 65, 85, 0.1);
}

.login-box button {
    width: 100%;
    margin-top: 25px;
    padding: 14px;
    background: #334155;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.login-box button:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.login-box button:active {
    transform: translateY(0);
}

.forgot {
    display: inline-block;
    margin-top: 20px;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.forgot:hover {
    color: #334155;
    text-decoration: underline;
}

.error {
    background: #fef2f2;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* =========================================
   MEDIA QUERIES (RESPONSIVIDADE)
   ========================================= */

/* Para telemóveis (menos de 480px de largura) */
@media (max-width: 480px) {
    .login-container {
        padding: 0 15px; /* Margem lateral menor */
    }

    .login-box {
        padding: 30px 20px; /* Menos padding interno para ganhar espaço */
        width: 100%;
    }

    .login-box h1 {
        font-size: 20px; /* Título ligeiramente menor */
        margin-bottom: 20px;
    }

    .logo {
        width: 100px; /* Logo ajustado */
        margin-bottom: 15px;
    }
    
    .login-box input, 
    .login-box button {
        padding: 12px; /* Inputs um pouco mais compactos */
    }
}

/* Para ecrãs muito curtos (ex: telemóvel deitado) */
@media (max-height: 600px) {
    body {
        align-items: flex-start; /* Alinha ao topo para permitir scroll */
        padding-top: 20px;
        padding-bottom: 20px;
    }
    
    .login-box {
        margin-top: 20px;
        margin-bottom: 20px;
    }
}