/* =========================================
   LEAD FORM — UI base
   ========================================= */

:root {
    /* Identidade Resolva Marcas — tema escuro, acento ciano, CTA verde */
    --bg-app: #01000d;
    --bg-app-gradient: linear-gradient(to bottom, #020024, #01000d);
    --bg-card: #0c0e1a;
    --bg-input: #12131f;

    --text-primary: #ffffff;
    --text-secondary: #aab3c2;
    --text-muted: #6b7480;

    /* Acento da marca (ciano) */
    --brand-primary: #68e1fd;
    --brand-hover: #3fcdf0;
    --brand-light: rgba(104, 225, 253, 0.08);
    --brand-border: rgba(104, 225, 253, 0.28);
    --brand-focus: rgba(104, 225, 253, 0.18);

    /* CTA principal (verde) */
    --cta: #25d366;
    --cta-hover: #1fb857;
    --cta-shadow: rgba(37, 211, 102, 0.28);

    --border: rgba(255, 255, 255, 0.10);
    --border-light: rgba(255, 255, 255, 0.06);

    --success: #10b981;
    --success-dark: #34d399;
    --success-bg: rgba(16, 185, 129, 0.14);

    --danger: #ef4444;
    --danger-dark: #fca5a5;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --danger-border: rgba(239, 68, 68, 0.35);

    --blue-bg: rgba(104, 225, 253, 0.14);
    --blue-text: #68e1fd;

    --purple-bg: rgba(104, 225, 253, 0.08);
    --purple-border: rgba(104, 225, 253, 0.28);
    --purple-text: #68e1fd;

    --disabled-bg: #2a2f3a;
    --disabled-text: #6b7480;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-card:
        0 10px 30px rgba(0, 0, 0, 0.55),
        0 2px 8px rgba(0, 0, 0, 0.4);

    --max-width: 680px;
}

/* =========================================
   RESET E BASE
   ========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    min-height: 100%;
    background: var(--bg-app);
}

body {
    min-height: 100vh;
    font-family: "Montserrat", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    background: url("../img/bg-all.webp") center center / cover no-repeat fixed;
    background-color: var(--bg-app);
}

button,
input {
    font-family: inherit;
}

button,
input,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    touch-action: manipulation;
}

[hidden] {
    display: none !important;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =========================================
   HEADER
   ========================================= */

.app-header {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 60px;
    padding: 0 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.brand-area {
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-logo-icon {
    display: block;
    width: auto;
    height: 34px;
    object-fit: contain;
}

/* =========================================
   CONTEÚDO PRINCIPAL
   ========================================= */

.app-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-width: 0;
    padding: 32px 20px;
}

.top-bar {
    width: 100%;
    max-width: var(--max-width);
    margin-bottom: 20px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.breadcrumbs .current {
    overflow: hidden;
    color: var(--text-primary);
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-sm {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* =========================================
   CONTAINER E CARD
   ========================================= */

.tool-container {
    width: 100%;
    max-width: var(--max-width);
}

.tool-card {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
    padding: 32px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card-meta-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.meta-tag.free {
    color: var(--success-dark);
    background: var(--success-bg);
}

.meta-tag.mode {
    color: var(--blue-text);
    background: var(--blue-bg);
}

.icon-xs {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* =========================================
   CABEÇALHO DO FORMULÁRIO
   ========================================= */

.tool-header {
    margin-bottom: 28px;
}

.tool-header h1 {
    margin-bottom: 6px;
    font-size: 1.5rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.tool-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* =========================================
   FORMULÁRIO
   ========================================= */

.system-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.form-section-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--brand-primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 6px;
}

.input-group.full {
    grid-column: span 2;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

input::placeholder {
    font-weight: 400;
    color: #5a626f;
}

input:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

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

input.is-invalid,
input[aria-invalid="true"] {
    border-color: var(--danger);
    background-color: rgba(239, 68, 68, 0.06);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.10);
}

input.is-invalid:focus,
input[aria-invalid="true"]:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.input-helper {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin-top: 2px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.input-helper svg {
    margin-top: 2px;
    flex-shrink: 0;
}

.icon-xxs {
    width: 10px;
    height: 10px;
}

.input-error {
    display: block;
    font-size: 0.75rem;
    line-height: 1.35;
    font-weight: 500;
    color: var(--danger-dark);
}

.input-error:empty {
    display: none;
}

/* =========================================
   ERRO GERAL
   ========================================= */

.form-error-message {
    padding: 12px 14px;
    margin-top: -4px;
    font-size: 0.82rem;
    line-height: 1.45;
    font-weight: 500;
    color: var(--danger-dark);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-md);
}

.form-error-message::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 7px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #ffffff;
    vertical-align: -2px;
    background: var(--danger);
    border-radius: 50%;
}

/* =========================================
   BOTÃO
   ========================================= */

.form-actions {
    width: 100%;
}

.btn-system {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 0 20px;
    overflow: hidden;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    background: var(--cta);
    border: none;
    border-radius: var(--radius-md);
    transition:
        background-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

.btn-system:hover:not(:disabled) {
    background: var(--cta-hover);
    box-shadow: 0 6px 18px var(--cta-shadow);
}

.btn-system:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-system:focus-visible {
    outline: 3px solid var(--brand-focus);
    outline-offset: 3px;
}

.btn-system:disabled {
    cursor: not-allowed;
}

.btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s ease;
}

.btn-content svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.btn-system.loading {
    cursor: wait;
}

.btn-system.loading .btn-content {
    opacity: 0.88;
}

.btn-system.quota-disabled {
    color: var(--disabled-text);
    background: var(--disabled-bg);
    box-shadow: none;
}

/* =========================================
   BARRA DE CARREGAMENTO
   ========================================= */

.loading-bar {
    position: absolute;
    bottom: 0;
    left: -40%;
    width: 40%;
    height: 4px;
    opacity: 0;
    background: rgba(255, 255, 255, 0.7);
}

.btn-system.loading .loading-bar {
    opacity: 1;
    animation: loadingBar 1.2s linear infinite;
}

@keyframes loadingBar {
    from {
        left: -40%;
    }

    to {
        left: 100%;
    }
}

/* =========================================
   PAINEL DE CONSULTAS
   ========================================= */

.quota-panel {
    padding: 16px;
    margin-bottom: 0;
    background: var(--brand-light);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-md);
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.quota-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-primary);
}

.quota-label {
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.icon-brand-sm {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--brand-primary);
}

.quota-value {
    white-space: nowrap;
}

.quota-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    background: rgba(104, 225, 253, 0.12);
    border-radius: 100px;
}

.quota-fill {
    width: 100%;
    height: 100%;
    background-color: var(--brand-primary);
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.45) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.45) 50%,
        rgba(255, 255, 255, 0.45) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    border-radius: 100px;
    transition: width 0.35s ease;
    animation: quotaStripes 0.9s linear infinite;
}

@keyframes quotaStripes {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 1rem 0;
    }
}

.quota-panel.is-exhausted {
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

.quota-panel.is-exhausted .quota-header,
.quota-panel.is-exhausted .icon-brand-sm {
    color: var(--danger-dark);
}

.quota-panel.is-exhausted .quota-track {
    background: rgba(239, 68, 68, 0.1);
}

.quota-panel.is-exhausted .quota-fill {
    background-color: var(--danger);
}

/* =========================================
   RODAPÉ DE SEGURANÇA DO CARD
   ========================================= */

.security-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
}

.security-footer span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.security-footer svg {
    flex-shrink: 0;
}

/* =========================================
   TELA DE SUCESSO
   ========================================= */

.system-success-view {
    padding: 20px 0;
    text-align: center;
}

.system-success-view h2 {
    margin-bottom: 8px;
    font-size: 1.4rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-primary);
}

.system-success-view > p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.success-loader {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
}

.loader-circle {
    width: 100%;
    height: 100%;
    border: 4px solid var(--success-bg);
    border-top-color: var(--success);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    color: var(--success);
    transform: translate(-50%, -50%);
}

.success-actions {
    margin-top: 16px;
}

.success-desc {
    max-width: 500px;
    margin: 0 auto;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.bonus-alert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    margin-top: 16px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--purple-text);
    background: var(--purple-bg);
    border: 1px solid var(--purple-border);
    border-radius: var(--radius-md);
}

.bonus-alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

/* =========================================
   BLOCOS DE CONFIANÇA
   ========================================= */

.specs-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.spec-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 12px 0;
    text-align: center;
    background: transparent;
    border: 1px solid transparent;
}

.spec-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.spec-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 0.8rem;
    line-height: 1.4;
}

.spec-text strong {
    color: var(--text-primary);
}

.spec-text span {
    color: var(--text-secondary);
}

/* =========================================
   RODAPÉ
   ========================================= */

.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: var(--max-width);
    margin-top: 40px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* =========================================
   ANIMAÇÕES
   ========================================= */

.animate-fade {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   RESPONSIVO
   ========================================= */

@media (max-width: 600px) {
    .app-header {
        height: 58px;
        padding: 0 16px;
    }

    .app-main {
        padding: 20px 16px;
    }

    .top-bar {
        margin-bottom: 16px;
    }

    .tool-card {
        padding: 24px 20px;
    }

    .tool-header {
        margin-bottom: 24px;
    }

    .tool-header h1 {
        font-size: 1.35rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .input-group.full {
        grid-column: auto;
    }

    .system-form {
        gap: 22px;
    }

    .quota-header {
        align-items: flex-start;
    }

    .quota-value {
        font-size: 0.75rem;
    }

    .security-footer {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-align: center;
    }

    .specs-grid {
        gap: 8px;
    }

    .spec-item {
        padding: 10px 2px;
    }

    .spec-text {
        font-size: 0.74rem;
    }

    .app-footer {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        margin-top: 32px;
    }

    .bonus-alert {
        align-items: flex-start;
        text-align: left;
    }
}

@media (max-width: 380px) {
    .app-main {
        padding-right: 12px;
        padding-left: 12px;
    }

    .tool-card {
        padding-right: 16px;
        padding-left: 16px;
    }

    .quota-header {
        flex-direction: column;
        gap: 6px;
    }

    .quota-value {
        align-self: flex-end;
    }

    .btn-system {
        padding-right: 14px;
        padding-left: 14px;
        font-size: 0.96rem;
    }

    .specs-grid {
        gap: 2px;
    }
}

/* =========================================
   REDUÇÃO DE MOVIMENTO
   ========================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}