/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    min-height: 100%;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;   /* mobile: começa do topo */
    padding: 0;
}

/* ── Container ── */
.login-container {
    width: 100%;
    max-width: 440px;
    padding: 24px 16px 40px;
    /* mobile: garante scroll se o conteúdo for maior que a tela */
}

/* ── Card ── */
.login-card {
    background: rgba(2, 6, 23, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    padding: 28px 24px 22px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
    color: #e5e7eb;
    /* impede que campos com zoom causem overflow em iOS */
    overflow: hidden;
}

/* ── Título ── */
h1 {
    margin: 0 0 4px;
    font-size: clamp(22px, 5vw, 28px);
    text-align: center;
    letter-spacing: -0.5px;
}

.subtitle {
    margin: 0 0 18px;
    font-size: 13px;
    text-align: center;
    color: #9ca3af;
}

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

label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #9ca3af;
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #040d1a;
    color: #e5e7eb;
    font-size: 16px;   /* 16px evita zoom automático no iOS */
    outline: none;
    transition: border-color .15s;
    -webkit-appearance: none;
}

input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* ── Botão principal ── */
#btnLogin {
    width: 100%;
    padding: 12px;
    border-radius: 999px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    letter-spacing: .3px;
    transition: opacity .15s, transform .1s;
}
#btnLogin:active { transform: scale(.98); opacity: .9; }

/* ── Alert ── */
.alert {
    margin-bottom: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .25);
    word-break: break-word;
}

/* ── Footer ── */
.footer {
    margin-top: 14px;
    font-size: 11px;
    text-align: center;
    color: #6b7280;
}

/* ── Tab toggle ── */
.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 22px;
    border-bottom: 1px solid #1f2937;
}

.login-tab {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}
.login-tab.is-active   { color: #e5e7eb; border-bottom-color: #2563eb; }
.login-tab:hover:not(.is-active) { color: #9ca3af; }

.tab-panel          { display: none; }
.tab-panel.is-active { display: block; }

/* ── Google button ── */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 12px;
    border-radius: 999px;
    border: 1px solid #374151;
    background: transparent;
    color: #e5e7eb;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    transition: background .15s;
    -webkit-appearance: none;
}
.btn-google:hover { background: rgba(255,255,255,.05); }
.btn-google svg   { flex-shrink: 0; }

/* ── Divider ── */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: #4b5563;
    font-size: 12px;
}
.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #1f2937;
}

/* ── Hint text ── */
.hint-text {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

/* ── Cadastro submit button ── */
#btnCadastro {
    width: 100%;
    padding: 12px;
    border-radius: 999px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    background: linear-gradient(135deg, #059669, #0d9488);
    color: white;
    transition: opacity .15s, transform .1s;
    -webkit-appearance: none;
}
#btnCadastro:active { transform: scale(.98); opacity: .9; }

/* ── Client selector ── */
.cliente-selector {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}
.cliente-selector.visible { display: flex; }
.cliente-selector select {
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid #374151;
    background: #040d1a;
    color: #e5e7eb;
    font-size: 16px;   /* evita zoom iOS */
}
.cliente-selector .hint-text { margin-top: 0; }

/* ── Loading spinner in select ── */
.email-loading {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
    display: none;
}

/* ── details/summary advanced ── */
details summary {
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

/* ────────────────────────────────────────────
   RESPONSIVE — tablet e desktop: centraliza
   ──────────────────────────────────────────── */
@media (min-width: 480px) {
    body {
        align-items: center;
        padding: 24px 16px;
    }

    .login-container {
        padding: 0;
    }
}

/* ── Extra small (< 360 px) ── */
@media (max-width: 359px) {
    .login-card {
        padding: 20px 16px 16px;
        border-radius: 14px;
    }

    .login-tab {
        font-size: 13px;
    }
}
