/* CLUBE DOS DETETIVES - LOGIN & REGISTRO NOIR (VERSÃO FINAL + MENU)
   Tema: Ficha de Credenciamento / Mesa de Detetive
*/

@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Abril+Fatface&family=Old+Standard+TT:ital,wght@0,400;0,700;1,400&family=Courier+Prime&display=swap');

:root {
    --wood-dark: #1a120b;
    --paper-aged: #e3dac9;
    --paper-white: #fdfbf7;
    --ink-color: #1a1a1a;
    --red-marker: #b30000;
    --gold-accent: #c5a059;
}

* { box-sizing: border-box; }

body, html {
    margin: 0; 
    padding: 0; 
    height: 100%;
    background-color: #0a0a0a;
    font-family: 'Old Standard TT', serif;
    color: #333;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

/* === FUNDO DA MESA === */
.desk-background {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: 
        linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.8)),
        url('https://www.transparenttextures.com/patterns/wood-pattern.png'),
        #2a1b0e; 
    background-blend-mode: multiply;
    z-index: -2;
    background-size: cover;
}

/* === HEADER AJUSTADO COM MENU === */
header {
    position: relative;
    width: 100%;
    display: flex; 
    align-items: center;
    justify-content: center; /* Logo centralizado por padrão */
    padding: 10px 20px;
    z-index: 10; 
    flex-shrink: 0;
}

.logo-img { 
    height: 120px; 
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); 
    transition: height 0.3s ease;
    display: block;
}

/* Link "Voltar" posicionado no canto */
.header-nav {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.btn-back-home {
    color: #e3dac9; /* Cor de papel envelhecido para contrastar com o fundo escuro */
    text-decoration: none;
    font-family: 'Special Elite', monospace;
    font-size: 1rem;
    border: 1px solid #e3dac9;
    padding: 8px 15px;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(0,0,0,0.3);
}

.btn-back-home:hover {
    background-color: var(--red-marker);
    border-color: var(--red-marker);
    color: #fff;
}

/* === CONTAINER CENTRAL === */
.login-container {
    display: flex; 
    justify-content: center; 
    align-items: flex-start;
    flex-grow: 1; 
    height: auto;
    padding: 40px 20px 80px; 
    min-height: 0;
}

/* === A FICHA DE ACESSO (CARD) === */
.access-card {
    background-color: var(--paper-white);
    width: 100%; 
    max-width: 500px;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.8),
        inset 0 0 60px rgba(0,0,0,0.05);
    transform: rotate(-1deg);
    position: relative;
    border: 1px solid #ccc;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23000000' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* Clipes de papel */
.paper-clip {
    position: absolute; top: -15px; right: 30px;
    width: 30px; height: 60px;
    border: 4px solid #555; border-radius: 15px;
    z-index: 2; box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

/* Carimbo */
.stamp-top-secret {
    position: absolute; top: 20px; right: 20px;
    border: 3px solid rgba(179, 0, 0, 0.3);
    color: rgba(179, 0, 0, 0.3);
    padding: 5px 10px;
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    transform: rotate(-15deg);
    pointer-events: none;
    font-weight: bold;
    text-transform: uppercase;
}

.card-header h2 {
    font-family: 'Abril Fatface', cursive;
    font-size: 2rem;
    margin: 0 0 5px 0;
    color: #111;
    text-transform: uppercase;
    border-bottom: 2px solid #111;
    padding-bottom: 10px;
}

.card-header p {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 30px;
}

/* === FORMULÁRIO === */
.form-group { margin-bottom: 25px; position: relative; }

.form-group label {
    display: block;
    font-family: 'Special Elite', monospace;
    font-size: 1rem;
    margin-bottom: 5px;
    color: #333;
}

.noir-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px dashed #888;
    padding: 10px 5px;
    font-family: 'Courier Prime', monospace;
    font-size: 1.2rem;
    color: #000;
    outline: none;
    transition: border-color 0.3s;
}

.noir-input:focus { border-bottom: 2px solid var(--red-marker); background-color: rgba(0,0,0,0.02); }
.noir-input::placeholder { color: #aaa; font-style: italic; font-size: 1rem; }

/* === SWITCH === */
.switch-container {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(0,0,0,0.03); padding: 10px;
    border-radius: 4px; border: 1px dashed #ccc; margin-bottom: 30px;
}
.noir-switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.noir-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .4s; border-radius: 34px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background-color: white;
    transition: .4s; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
input:checked + .slider { background-color: var(--red-marker); }
input:checked + .slider:before { transform: translateX(26px); }

/* === SUBMIT === */
.btn-stamp-submit {
    display: block; width: 100%; margin-top: 10px; padding: 15px;
    background: transparent; color: var(--red-marker);
    border: 3px solid var(--red-marker); font-family: 'Special Elite', monospace;
    font-size: 1.5rem; font-weight: bold; text-transform: uppercase;
    cursor: pointer; transition: all 0.2s; border-radius: 5px;
    transform: rotate(-1deg);
}
.btn-stamp-submit:hover {
    background: var(--red-marker); color: #fff;
    transform: scale(1.02) rotate(0deg);
    box-shadow: 0 0 15px rgba(179, 0, 0, 0.4);
}
.btn-stamp-submit:disabled { opacity: 0.5; cursor: wait; }

/* Links */
.form-links {
    margin-top: 20px; text-align: center;
    font-family: 'Courier New', monospace; font-size: 0.9rem;
}
.form-links a { 
    color: #666; text-decoration: none; border-bottom: 1px dotted #666; margin: 0 10px; 
}
.form-links a:hover { color: var(--red-marker); border-color: var(--red-marker); }

/* Login Google */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 20px;
    color: #746b62;
    font: 700 0.78rem/1 'Special Elite', monospace;
    letter-spacing: 0.12em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #aaa);
}

.auth-divider::after {
    background: linear-gradient(90deg, #aaa, transparent);
}

.google-signin-area {
    width: 100%;
    text-align: center;
}

#googleSignInButton {
    width: 100%;
    min-height: 44px;
    display: flex;
    justify-content: center;
}

.google-signin-area p,
.legal-login-note,
.google-link-explanation {
    color: #655f59;
    font: 0.78rem/1.5 'Courier New', monospace;
}

.google-signin-area p {
    margin: 9px 0 0;
}

.legal-login-note {
    margin: 20px 0 0;
    text-align: center;
}

.legal-login-note a {
    color: #5d1717;
    text-underline-offset: 2px;
}

/* Confirmação de vínculo de uma conta local existente */
.google-link-card {
    max-width: 520px;
}

.google-link-message {
    display: block;
}

.google-link-identity {
    margin: 0 0 18px;
    padding: 13px 15px;
    border: 1px dashed #aaa;
    background: rgba(0, 0, 0, 0.035);
}

.google-link-identity span,
.google-link-identity strong {
    display: block;
}

.google-link-identity span {
    margin-bottom: 4px;
    color: #777;
    font: 700 0.72rem/1.2 'Special Elite', monospace;
    letter-spacing: 0.1em;
}

.google-link-identity strong {
    overflow-wrap: anywhere;
    color: #222;
    font: 700 0.96rem/1.4 'Courier New', monospace;
}

.google-link-explanation {
    margin: 0 0 23px;
}

.password-field {
    position: relative;
}

.password-field .noir-input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 2px;
    top: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #666;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--red-marker);
}

.google-link-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 18px;
}

.google-link-actions a {
    margin: 0;
}

/* Alerts */
.status-message {
    display: none; margin-bottom: 20px; padding: 10px;
    font-family: 'Courier Prime', monospace; font-size: 0.95rem; text-align: center;
    border-left: 4px solid;
}
.status-message.error { background-color: rgba(179, 0, 0, 0.1); color: #b30000; border-color: #b30000; }
.status-message.success { background-color: rgba(0, 128, 0, 0.1); color: #006400; border-color: #006400; }

.spinner {
    display: inline-block; width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff;
    animation: spin 1s ease-in-out infinite; margin-right: 10px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVIDADE === */
@media (max-width: 768px) {
    header {
        flex-direction: column; /* Logo em cima, link embaixo */
        padding: 20px;
        gap: 15px;
    }
    
    .logo-img { height: 120px; }
    
    .header-nav {
        position: static; /* Remove posição absoluta no mobile */
        transform: none;
    }

    .access-card { 
        padding: 25px; 
        transform: none; 
        margin-top: 10px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    }
    
    .card-header h2 { font-size: 1.5rem; }
    
    .noir-input { padding: 15px 5px; }

    .login-container { 
        padding: 10px 15px 40px; 
        align-items: flex-start; 
    }
}
