@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
    color-scheme: light;

    --primary-color: #0f4c81;
    --primary-hover: #0b6a5a;
    --accent: #f26a4b;

    --login-bg: #f5efe8;
    --login-bg-2: #e7f0f4;
    --login-pattern-dot: rgba(15, 76, 129, 0.16);

    --surface: #ffffff;
    --surface-2: #f9fbfc;
    --surface-border: rgba(15, 23, 42, 0.08);
    --shadow: 0 26px 60px rgba(15, 23, 42, 0.18);

    --text: #1f2937;
    --muted: #5b6675;
    --muted-2: #768393;

    --input-bg: #ffffff;
    --input-border: #d6dde4;
    --input-focus-ring: rgba(15, 76, 129, 0.22);

    --divider: #E0E0E0;

    --eula-bg: #fafafa;
    --secondary-btn-bg: #efefef;
    --secondary-btn-hover-bg: #e3e3e3;

    --google-btn-bg: #ffffff;
    --google-btn-border: rgba(2, 6, 23, 0.14);
    --google-btn-hover-bg: rgba(2, 6, 23, 0.04);
    --google-btn-hover-border: rgba(2, 6, 23, 0.22);

    --modal-overlay: rgba(0, 0, 0, 0.5);

    --header-grad-1: #0f2f4f;
    --header-grad-2: #1b6a5c;
    --header-curve-fill: var(--surface);

    --status-info-bg: #eaf3ff;
    --status-info-text: #1d4f8c;
    --status-success-bg: #eaf7ef;
    --status-success-text: #276846;
    --status-warning-bg: #fff8e6;
    --status-warning-text: #8a5a00;
    --status-error-bg: #ffecec;
    --status-error-text: #8b1d1d;
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --primary-color: #62a5d9;
    --primary-hover: #3cb081;
    --accent: #ff8c6f;

    --login-bg: #0a101b;
    --login-bg-2: #121e2b;
    --login-pattern-dot: rgba(98, 165, 217, 0.14);

    --surface: #0f172a;
    --surface-2: #111c31;
    --surface-border: rgba(148, 163, 184, 0.14);
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);

    --text: rgba(248, 250, 252, 0.92);
    --muted: rgba(226, 232, 240, 0.72);
    --muted-2: rgba(226, 232, 240, 0.62);

    --input-bg: rgba(15, 23, 42, 0.9);
    --input-border: rgba(148, 163, 184, 0.18);
    --input-focus-ring: rgba(98, 165, 217, 0.24);

    --divider: rgba(148, 163, 184, 0.18);

    --eula-bg: rgba(2, 6, 23, 0.35);
    --secondary-btn-bg: rgba(148, 163, 184, 0.12);
    --secondary-btn-hover-bg: rgba(148, 163, 184, 0.18);

    --google-btn-bg: rgba(15, 23, 42, 0.55);
    --google-btn-border: rgba(148, 163, 184, 0.24);
    --google-btn-hover-bg: rgba(148, 163, 184, 0.10);
    --google-btn-hover-border: rgba(148, 163, 184, 0.34);

    --modal-overlay: rgba(0, 0, 0, 0.62);

    --header-grad-1: rgba(17, 43, 66, 0.98);
    --header-grad-2: rgba(30, 96, 86, 0.98);
    --header-curve-fill: var(--surface);

    --status-info-bg: rgba(56, 189, 248, 0.12);
    --status-info-text: rgba(186, 230, 253, 0.95);
    --status-success-bg: rgba(54, 167, 107, 0.12);
    --status-success-text: rgba(187, 247, 208, 0.95);
    --status-warning-bg: rgba(251, 191, 36, 0.12);
    --status-warning-text: rgba(254, 243, 199, 0.95);
    --status-error-bg: rgba(248, 113, 113, 0.12);
    --status-error-text: rgba(254, 202, 202, 0.95);
}

/* ---------------------------------------------------
   RESET + PWA FIRST
--------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.body {
    margin: 0;
    font-family: 'Inter', sans-serif;

    /* Fundo */
    background-color: var(--login-bg);
    background-image:
        radial-gradient(circle at 15% 12%, rgba(242, 106, 75, 0.18), transparent 52%),
        radial-gradient(circle at 85% 88%, rgba(15, 76, 129, 0.18), transparent 50%),
        radial-gradient(var(--login-pattern-dot) 0.6px, transparent 0.6px),
        linear-gradient(160deg, var(--login-bg), var(--login-bg-2));
    background-size: auto, auto, 18px 18px, auto;

    /* Viewport PWA correta */
    min-height: 100svh;
    min-height: 100dvh;


    display: flex;
    align-items: center;
    justify-content: center;

    /* Safe-area (notch / gesture bar) */
    padding:
        calc(16px + env(safe-area-inset-top))
        calc(16px + env(safe-area-inset-right))
        calc(16px + env(safe-area-inset-bottom))
        calc(16px + env(safe-area-inset-left));

    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------
   CONTAINER
--------------------------------------------------- */
.container {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--surface-border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

/* Animação */
.fade-in {
    animation: fadeIn .4s ease-in-out;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------------------------------------------
   HEADER
--------------------------------------------------- */
.header {
    height: 190px;
    background: linear-gradient(to bottom right, var(--header-grad-1), var(--header-grad-2));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.2;
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%23ffffff"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/svg%3E');
}

/* Logo */
.logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 10;
    color: #ffffff;
    gap: 10px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 14px 30px rgba(0, 0, 0, 0.25);
}

.logo-area h1 {
    margin: 0;
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-tagline {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.02em;
}

.theme-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    transition: transform .15s ease, background .2s ease, border-color .2s ease;
    z-index: 20;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.28);
}

.theme-toggle:active {
    transform: translateY(1px);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
}

/* Curva inferior */
.header-curve {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 48px;
}

.header-curve-path {
    fill: var(--header-curve-fill);
}
/* ---------------------------------------------------
   CONTEÚDO
--------------------------------------------------- */
.content {
    padding: 22px 30px 26px;
}

/* Textos */
.title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.subtitle {
    margin-top: 2px;
    margin-bottom: 22px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.45;
}

/* ---------------------------------------------------
   INPUTS
--------------------------------------------------- */
.input-group {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.input-field {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 15px;
    transition: .25s ease;
}

.input-field::placeholder {
    color: var(--muted);
    opacity: 0.85;
}

.input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
    outline: none;
}

.input-field:focus-visible {
    outline: none;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-2);
    font-size: 16px;
}

/* ---------------------------------------------------
   BOTÃO LOGIN
--------------------------------------------------- */
.btn-login {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #ffffff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .25s ease, filter .25s ease;
    font-size: medium;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.18);
}

.btn-login:hover {
    filter: brightness(1.05);
}

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

.btn-login:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--input-focus-ring), 0 10px 30px rgba(2, 6, 23, 0.12);
}

.btn-login.btn-register {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--divider);
    box-shadow: none;
}

.btn-login.btn-register:hover {
    background: rgba(2, 6, 23, 0.04);
}

:root[data-theme="dark"] .btn-login.btn-register:hover {
    background: rgba(148, 163, 184, 0.10);
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

.forgot-link {
    margin-top: 12px;
    text-align: center;
}

.forgot-link a {
    color: var(--primary-color);
    font-size: 0.92rem;
    text-decoration: none;
    font-weight: 600;
}

.forgot-link a:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------
   DIVISOR
--------------------------------------------------- */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.divider div {
    flex: 1;
    height: 1px;
    background: var(--divider);
}

.divider span {
    font-size: 11px;
    color: var(--muted);
}

/* ---------------------------------------------------
   SOCIAL
--------------------------------------------------- */

.social-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* ---------------------------------------------------
   SOCIAL BUTTONS — MESMA ALTURA DO BOTÃO DE LOGIN
--------------------------------------------------- */
.social-btn,
.social-btn-apple {
    width: 100%;
    height: 50px;                    /* ← mesma altura do .btn-login */
    padding: 0 14px;                 /* ← padding horizontal só, vertical controlado pelo height */
    border-radius: 14px;
    border: 1px solid var(--google-btn-border);
    background: var(--google-btn-bg);             /* ← fundo branco (Google recomenda) */
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    font-size: medium;
    cursor: pointer;
    transition: all .25s ease;
    box-sizing: border-box;          /* ← importante */
    margin: 8px 0;                   /* ← espaçamento uniforme */
}

.social-btn:hover {
    background: var(--google-btn-hover-bg);
    border-color: var(--google-btn-hover-border);
}

.social-btn-apple {
    background: #000000;
    color: #ffffff;
    border: none;
}

.social-btn-apple:hover {
    background: #dadada;
}

/* ---------------------------------------------------
   LINK CRIAR CONTA
--------------------------------------------------- */

.legal-note {
    margin-top: 14px;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.legal-note a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.legal-note a:hover {
    text-decoration: underline;
}

@media (max-width: 520px) {
    .header {
        height: 170px;
    }

    .logo-icon {
        width: 62px;
        height: 62px;
    }
}

@media (min-width: 768px) {
    body.body {
        padding: 32px;
    }
}

/* =========================================
   ESTILOS DO MODAL DE MENSAGEM
   ========================================= */

/* Fundo do Modal */
.modal {
    display: none; 
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--modal-overlay); /* Fundo escurecido */
    z-index: 5000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s;
}

#messageModal {
    z-index: 7000;
}

/* Caixa de Conteúdo */
.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--surface-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

/* Container do Ícone (Círculo colorido) */
.modal-icon-container {
    width: 70px;
    height: 70px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px auto;
}

/* Títulos e Textos */
.modal-content h2 {
    margin-bottom: 10px;
    color: var(--text);
    font-size: 1.5rem;
}

.modal-content p {
    color: var(--muted);
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Botão OK (Estilo padrão do sistema) */
.modal-content .btn-primary {
    background-color: var(--primary-color); /* Cor verde padrão */
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.modal-content .btn-primary:hover {
    background-color: var(--primary-hover);
}

#eulaModal .modal-content {
    max-width: 520px;
    text-align: left;
}

.eula-box {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--divider);
    border-radius: 10px;
    padding: 14px;
    background: var(--eula-bg);
    margin-bottom: 16px;
}

.eula-box p {
    margin-bottom: 10px;
}

.eula-box p:last-child {
    margin-bottom: 0;
}

.eula-box a {
    color: var(--primary-hover);
    font-weight: 600;
    text-decoration: none;
}

.eula-box a:hover {
    text-decoration: underline;
}

.eula-actions {
    display: flex;
    gap: 10px;
}

.eula-actions .btn-secondary,
.eula-actions .btn-primary {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 600;
    cursor: pointer;
}

.eula-actions .btn-secondary {
    background: var(--secondary-btn-bg);
    color: var(--text);
}

.eula-actions .btn-secondary:hover {
    background: var(--secondary-btn-hover-bg);
}

.modal-content .recover-status {
    font-size: 0.9rem;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    text-align: left;
}

.recover-status.info {
    background: var(--status-info-bg);
    color: var(--status-info-text);
}

.recover-status.success {
    background: var(--status-success-bg);
    color: var(--status-success-text);
}

.recover-status.warning {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.recover-status.error {
    background: var(--status-error-bg);
    color: var(--status-error-text);
}

/* --- ANIMAÇÕES --- */
@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes slideUp { 
    from { transform: translateY(20px); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; } 
}

@media (prefers-reduced-motion: reduce) {
    .fade-in {
        animation: none;
    }
    .loader {
        animation-duration: 1.2s;
    }
}
