/* ============================================================
   MODAL OBRIGATÓRIA DE TERMOS DE USO E POLÍTICA DE PRIVACIDADE
   ============================================================ */

/* --- Overlay bloqueante --- */
#termos-overlay {
    display: none; /* Mostrado via JS ao chamar TermosModal.show() */
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 10, 30, 0.78);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#termos-overlay.visivel {
    display: flex;
}

/* --- Caixa do modal --- */
.termos-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    width: 100%;
    max-width: 780px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: termos-aparecer 0.3s ease-out;
}

@keyframes termos-aparecer {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* --- Cabeçalho --- */
.termos-header {
    padding: 22px 26px 16px;
    border-bottom: 1px solid #e8eaf0;
    flex-shrink: 0;
}

.termos-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.termos-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.termos-icon i { color: #fff; font-size: 18px; }

.termos-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.3;
}

.termos-header p {
    font-size: 0.87rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.termos-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.74rem;
    font-weight: 600;
    margin-top: 8px;
}

/* --- Corpo --- */
.termos-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 26px;
    min-height: 0;
}

/* Preview parcial */
.termos-preview {
    position: relative;
    margin: 16px 0 12px;
}

.termos-preview-doc {
    background: #f8f9fc;
    border: 1px solid #dde1ea;
    border-radius: 10px;
    padding: 18px 20px;
    max-height: 185px;
    overflow: hidden;
    position: relative;
    font-size: 0.84rem;
    line-height: 1.65;
    color: #374151;
}

.termos-preview-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 75px;
    background: linear-gradient(transparent, #f8f9fc);
    border-radius: 0 0 10px 10px;
    pointer-events: none;
}

.termos-preview-doc h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
    text-align: center;
}

/* Painel de leitura completa */
.termos-full {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 10px;
}

.termos-full.ativo { display: flex; }

/* Barra de progresso */
.termos-scroll-progress {
    height: 3px;
    background: #e0e7ff;
    border-radius: 0 0 4px 4px;
    margin-bottom: 4px;
    overflow: hidden;
}

.termos-scroll-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    width: 0%;
    transition: width 0.15s ease;
    border-radius: 4px;
}

/* Container scrollável */
.termos-scroll-container {
    flex: 1;
    overflow-y: auto;
    border: 2px solid #e0e7ff;
    border-radius: 10px;
    background: #fafbff;
    padding: 20px 22px;
    scroll-behavior: smooth;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #6366f1 #e0e7ff;
}

.termos-scroll-container::-webkit-scrollbar { width: 6px; }
.termos-scroll-container::-webkit-scrollbar-track { background: #e0e7ff; border-radius: 3px; }
.termos-scroll-container::-webkit-scrollbar-thumb { background: #6366f1; border-radius: 3px; }

/* Conteúdo dos termos */
.termos-doc-content {
    font-size: 0.84rem;
    line-height: 1.7;
    color: #374151;
}

.termos-doc-content h4 {
    font-size: 0.98rem;
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
    margin: 0 0 4px;
}

.termos-doc-content .termos-meta {
    text-align: center;
    color: #6b7280;
    font-size: 0.79rem;
    margin-bottom: 14px;
}

.termos-doc-content hr {
    border: none;
    border-top: 1px solid #dde1ea;
    margin: 12px 0;
}

.termos-doc-content h5 {
    font-size: 0.83rem;
    font-weight: 700;
    color: #4f46e5;
    margin: 16px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.termos-doc-content p { margin: 0 0 10px; }

#termos-scroll-sentinel { height: 1px; margin-top: 8px; }

/* --- Botão "Ler termos completos" --- */
.termos-btn-ler {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    margin: 2px 0 14px;
    align-self: flex-start;
}

.termos-btn-ler:hover { opacity: 0.9; transform: translateY(-1px); }

/* --- Rodapé --- */
.termos-footer {
    flex-shrink: 0;
    padding: 12px 26px 20px;
    border-top: 1px solid #e8eaf0;
    background: #f9fafb;
}

/* Aviso de scroll */
.termos-scroll-aviso {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef9ec;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.81rem;
    color: #92400e;
    margin-bottom: 10px;
}

.termos-scroll-aviso i { color: #f59e0b; }
.termos-scroll-aviso.oculto { display: none; }

/* Checkbox */
.termos-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

#termos-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    cursor: default;
    flex-shrink: 0;
    margin-top: 1px;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}

#termos-checkbox:enabled { cursor: pointer; border-color: #4f46e5; }
#termos-checkbox:checked { background: #4f46e5; border-color: #4f46e5; }
#termos-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px; left: 5px;
    width: 5px; height: 9px;
    border: 2px solid #fff;
    border-top: none; border-left: none;
    transform: rotate(45deg);
}

.termos-checkbox-label {
    font-size: 0.86rem;
    color: #6b7280;
    line-height: 1.4;
    user-select: none;
}

.termos-checkbox-label.habilitado { color: #374151; }

/* Botão Continuar */
#termos-btn-continuar {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #d1d5db;
    color: #9ca3af;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: default;
    letter-spacing: 0.02em;
    transition: background 0.25s, color 0.25s, transform 0.1s, box-shadow 0.25s;
}

#termos-btn-continuar.ativo {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(79, 70, 229, 0.4);
}

#termos-btn-continuar.ativo:hover { opacity: 0.92; transform: translateY(-1px); }
#termos-btn-continuar.carregando { opacity: 0.7; cursor: wait; }

.termos-legal-note {
    margin-top: 8px;
    font-size: 0.74rem;
    color: #9ca3af;
    text-align: center;
}

@media (max-width: 600px) {
    .termos-modal { border-radius: 10px; }
    .termos-header, .termos-body, .termos-footer { padding-left: 16px; padding-right: 16px; }
}
