/* =========================================
   ESTILOS GLOBAIS E DESKTOP (Base Geométrico)
   ========================================= */
body { 
    margin: 0; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    
    /* Fundo base */
    background-color: #f4f7f6; 
    
    /* Grelha de Coordenadas Estática (Quadrados mais pequenos: 50px e 10px) */
    background-image: 
        linear-gradient(rgba(26, 26, 26, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 26, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(26, 26, 26, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 26, 0.02) 1px, transparent 1px);
    background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
    background-position: center center;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    overflow: hidden; 
}

/* Detalhe de Vigília com Coordenadas do Porto */
body::after {
    content: "LAT: 41.1579° N | LON: 8.6291° W"; 
    position: absolute;
    bottom: 20px;
    right: 30px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(26, 26, 26, 0.4);
    letter-spacing: 2px;
    z-index: 0; 
}

.text-accent { color: #FF8400 !important; }

.container { 
    width: 90%; 
    max-width: 850px; 
    background: white; 
    display: flex; 
    border-radius: 20px; 
    overflow: hidden; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.1); 
    height: 500px;
    position: relative;
    z-index: 10; /* Garante que fica acima da grelha de fundo */
}

/* --- LADO ESQUERDO --- */
.left-side { 
    flex: 1; 
    background-image: url('../images/banner-login.jpg'); 
    background-size: cover; 
    background-position: center;
    padding: 40px; 
    color: white; 
    display: flex; 
    flex-direction: column; 
    position: relative; 
}

.left-side::before { 
    content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(0, 0, 0, 0.4); z-index: 1;
}

.senna-quote {
    position: absolute; bottom: 40px; left: 40px; right: 40px;
    z-index: 2; border-left: 3px solid #FF8400; padding-left: 20px;
}

.quote-text { font-style: italic; font-size: 0.95rem; line-height: 1.5; margin: 0; }
.quote-author { display: block; font-weight: 700; font-size: 0.8rem; text-align: right; margin-top: 6px; }

/* --- LADO DIREITO E FORMULÁRIO --- */
.right-side { 
    flex: 1; 
    padding: 40px 50px; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: stretch;
    z-index: 2;
}

.logo-box { text-align: center; margin-bottom: 20px; } 
.logo-box img { max-width: 260px; height: auto; margin: 0 auto; display: block; }

/* Regras Estritas de Logo no Desktop/Tablet */
.logo-default { display: block !important; }
.logo-mobile-dark { display: none !important; }

.input-group { margin-bottom: 12px; } 
.input-group input { 
    width: 100%; padding: 14px 20px; border: 1px solid #ddd; border-radius: 25px; 
    font-size: 14px; outline: none; box-sizing: border-box; background: #fafafa;
}

.btn-signin { 
    width: 100%; background: #FF8400; color: white; border: none; padding: 15px; 
    border-radius: 25px; font-size: 16px; font-weight: bold; cursor: pointer; transition: 0.3s;
    margin-top: 10px;
}

/* =========================================
   MOBILE - MODO RETRATO / VERTICAL
   ========================================= */
@media (max-width: 768px) and (orientation: portrait) { 
    /* Esconder coordenadas no telemóvel para manter a interface limpa */
    body::after { display: none; }

    .container { 
        width: 100%; height: 100vh; border-radius: 0; box-shadow: none;
        background-image: url('../images/banner-login.jpg'); 
        background-size: cover; 
        background-position: center;
    }

    .container::before {
        content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; 
        background: rgba(0, 0, 0, 0.55); 
        backdrop-filter: blur(3px); 
        -webkit-backdrop-filter: blur(3px);
        z-index: 1;
    }

    .left-side { display: none; }
    
    .right-side { 
        background: transparent; padding: 30px; justify-content: center; 
        height: 100%; box-sizing: border-box;
    }

    .logo-default { display: none !important; }
    .logo-mobile-dark { 
        display: block !important; max-width: 200px; margin: 0 auto 15px auto; 
    }

    .input-group input {
        background: rgba(255, 255, 255, 0.85); 
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        color: #1a1a1a;
    }

    .input-group input::placeholder { color: #666; }

    .btn-signin { 
        background: #F39C12; box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4); margin-top: 15px;
    }

    #msgError { color: #ff8a80; font-weight: 600; margin-top: 15px; text-align: center; font-size: 13px; }
}

/* =========================================
   MOBILE E PEQUENOS ECRÃS - MODO PAISAGEM (HORIZONTAL)
   ========================================= */
@media (max-height: 600px) and (orientation: landscape) {
    body::after { display: none; }

    .container {
        width: 100%; height: 100vh; max-width: 100%; border-radius: 0; box-shadow: none;
    }

    .senna-quote { display: none !important; }

    .right-side { padding: 10px 30px; justify-content: center; }

    .logo-box { margin-top: 0; margin-bottom: 10px; }
    .logo-box img { max-width: 220px; }

    .input-group { margin-bottom: 8px; }
    .input-group input { padding: 10px 15px; }

    .btn-signin { padding: 12px; margin-top: 5px; font-size: 15px; }
    #msgError { margin-top: 8px; padding: 8px; font-size: 12px; }
}

/* --- ESTILOS DO FORMULÁRIO DE RECUPERAÇÃO --- */
.forgot-text {
    font-size: 14px;
    color: #1a1a1a; /* Desktop: Cinza muito escuro */
    margin-bottom: 15px;
    text-align: center;
}

.back-login-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: #1a1a1a; /* Desktop: Cinza muito escuro */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

.back-login-link:hover {
    color: #FF8400;
}

/* --- MEDIA QUERY MOBILE (Ajuste de Contrastes) --- */
@media (max-width: 768px) {
    .forgot-text {
        color: #ffffff; /* Mobile: Letras brancas no fundo escuro */
    }
    
    .back-login-link {
        color: #FF8400; /* Mobile: Laranja para destacar */
    }
}

/* --- BOTÕES --- */
.btn-orange {
    background-color: #FF8400;
    color: #ffffff;
    transition: background-color 0.3s ease;
    border: none;
}

.btn-orange:hover {
    background-color: #e67600;
}

/* --- LINKS DE AÇÃO (Esqueceu a Passe / Voltar) --- */
.link-action {
    display: block;
    text-align: center;      /* Centralizado */
    margin-top: 25px;        /* Mais espaço / respiro */
    font-size: 14px;
    color: #1a1a1a;
    text-decoration: underline; /* Sublinhado para indicar link */
    font-weight: 300;
    transition: color 0.3s ease;
}

.link-action i {
    margin-right: 6px;       /* Espaço entre ícone e texto */
}

.link-action:hover {
    color: #FF8400;
}

/* --- FORMULÁRIO OCULTO --- */
.hidden-form {
    display: none;
}

/* --- INPUT DE PASSWORD COM OLHO --- */
.password-group {
    position: relative;
    display: flex;
    align-items: center;
}

.password-group input {
    width: 100%;
    padding-right: 45px; /* Impede o texto de ficar por baixo do ícone */
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    outline: none;
    transition: color 0.3s ease;
}

.btn-toggle-password:hover {
    color: #FF8400;
}

/* --- AJUSTES MOBILE (Contraste Fundo Escuro) --- */
@media (max-width: 768px) {
    .link-action, .forgot-text {
        color: #ffffff; /* Letras brancas no telemóvel */
    }
    
    .link-action:hover {
        color: #FF8400;
    }
    
    .btn-toggle-password {
        color: #aaaaaa;
    }
}
