/* ===========================================================
   A Frequência — POC v0.1 — Estilos Globais
   =========================================================== */

/* Garantir que o footer não grude */
html, body {
    height: 100%;
    margin: 0;
}

body {
    background: #f4f6f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
}

/* Container principal empurra footer */
main.container {
    min-height: 70vh;
}

/* Cards e sombras */
.card {
    border: none;
    border-radius: 12px;
}

.card.shadow {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Tabelas responsivas */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table td {
    vertical-align: middle;
}

/* Pre (CORE exibição) */
.pre-wrap {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Badges */
.badge {
    font-weight: 500;
}

/* Botões */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

/* ===========================================================
   Anamnese Viva
   =========================================================== */

.anamnese-container {
    max-width: 100%;
    min-height: calc(100vh - 76px);
    background: #0d1117;
    color: #e6edf3;
    display: flex;
    flex-direction: column;
}

.anamnese-header {
    background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
    border-bottom: 1px solid #30363d;
    padding: 1rem 0;
}

.anamnese-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f0f6fc;
    margin: 0;
}

.anamnese-subtitle {
    font-size: 0.8rem;
    color: #8b949e;
    margin: 0;
}

.anamnese-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #238636, #2ea043);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.anamnese-stats {
    font-size: 0.8rem;
    color: #8b949e;
    text-align: right;
}

/* Progresso */
.progress-container {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #8b949e;
    margin-bottom: 0.4rem;
}

.progress-bar-custom {
    height: 6px;
    background: #21262d;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #238636, #2ea043);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Risk Banner */
.risk-banner {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.risk-banner.alerta {
    background: rgba(210, 153, 34, 0.15);
    border: 1px solid #d29922;
    color: #d29922;
}

.risk-banner.perigo {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid #f85149;
    color: #f85149;
}

/* Chat */
.chat-box {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 300px;
    max-height: 55vh;
}

.message {
    display: flex;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
    justify-content: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.msg-content {
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .msg-content {
    background: linear-gradient(135deg, #238636, #2ea043);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .msg-content {
    background: #21262d;
    color: #e6edf3;
    border-bottom-left-radius: 4px;
}

/* Feedback message */
.feedback-msg {
    align-self: center;
    max-width: 90%;
}

.feedback-content {
    background: rgba(46, 160, 67, 0.1);
    border: 1px solid rgba(46, 160, 67, 0.3);
    color: #3fb950;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    text-align: center;
    font-style: italic;
}

/* Transição message */
.transicao-msg {
    align-self: center;
    max-width: 90%;
}

.transicao-content {
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    color: #58a6ff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    text-align: center;
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 0.6rem 1rem;
    background: #21262d;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8b949e;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1.1); }
}

/* Input area */
.chat-input-area {
    position: sticky;
    bottom: 0;
    background: #161b22;
    border-top: 1px solid #30363d;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    min-height: 40px;
    max-height: 120px;
}

.chat-input:focus {
    border-color: #238636;
}

.chat-input::placeholder {
    color: #484f58;
}

.chat-input:disabled {
    opacity: 0.5;
}

.chat-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #238636, #2ea043);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-send:not(:disabled):hover {
    opacity: 0.9;
}

/* Finalize Overlay */
.finalize-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.finalize-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.finalize-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.finalize-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.finalize-content h2 {
    color: #f0f6fc;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.finalize-content p {
    color: #8b949e;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ===========================================================
   Autenticação — Login & Criar Usuário
   =========================================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #0f0a1a 30%, #0a0a12 60%, #0a0a0a 100%);
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
}

/* Partículas de fundo / orbes */
.auth-page::before {
    content: "";
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.08) 0%, transparent 70%);
    top: -200px;
    right: -150px;
    border-radius: 50%;
    pointer-events: none;
    animation: authOrbFloat 12s ease-in-out infinite;
}

.auth-page::after {
    content: "";
    position: absolute;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    border-radius: 50%;
    pointer-events: none;
    animation: authOrbFloat 15s ease-in-out infinite reverse;
}

@keyframes authOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 30px) scale(0.95); }
}

.auth-container {
    width: 100%;
    max-width: 440px;
    z-index: 1;
    animation: authFadeIn 0.6s ease-out;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card {
    background: rgba(22, 22, 30, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 80px rgba(124, 58, 237, 0.05);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 8px 50px rgba(0, 0, 0, 0.6), 0 0 100px rgba(124, 58, 237, 0.08);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(124, 58, 237, 0.25);
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0f6fc;
    margin: 0 0 0.35rem;
    letter-spacing: -0.3px;
}

.auth-header p {
    font-size: 0.9rem;
    color: #8b949e;
    margin: 0;
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #c9d1d9;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-form .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #f0f6fc;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.25s ease;
    box-sizing: border-box;
    outline: none;
}

.auth-form .form-input::placeholder {
    color: #484f58;
}

.auth-form .form-input:focus {
    background: rgba(124, 58, 237, 0.06);
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.auth-form .form-input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.btn-full {
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn-full::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #8b5cf6, #818cf8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-full:hover::before {
    opacity: 1;
}

.btn-full span {
    position: relative;
    z-index: 1;
}

.btn-full:hover {
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
}

.btn-full:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-footer p {
    color: #8b949e;
    font-size: 0.85rem;
    margin: 0;
}

.auth-footer a {
    color: #a78bfa;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* Flash messages na auth */
.auth-flash {
    padding: 0.7rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    animation: authFadeIn 0.3s ease-out;
}

.auth-flash.danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.auth-flash.success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #86efac;
}

/* ===========================================================
   Responsivo
   =========================================================== */
@media (max-width: 768px) {
    .message {
        max-width: 95%;
    }
    .chat-box {
        max-height: 45vh;
        min-height: 200px;
    }
    .auth-card {
        padding: 2rem 1.5rem;
    }
    .auth-container {
        max-width: 100%;
    }
}
