/* ============================================================
 * Comunidade Solar de Vilamoura — formulário autónomo (iframe)
 * ============================================================ */
:root {
    --texto: #000;
    --texto-2: #222;
    --linha: #000;
    --azul: #2064f2;
    --azul-escuro: #1a50c4;
    --cinza: #e9eae6;
    --erro: #c62828;
    --erro-fundo: #fdecea;
    --fundo: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
    background: transparent;   /* fora dos cantos arredondados vê-se o fundo do site anfitrião */
    color: var(--texto);
    font-family: Arimo, Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.caixa {
    padding: 0px 0px 0px;
    background: var(--fundo);
}

/* ---------- Grelha (12 colunas, como no site) ---------- */
.grelha {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px 20px;
}
.c4  { grid-column: span 4; }
.c6  { grid-column: span 6; }
.c8  { grid-column: span 8; }
.c12 { grid-column: span 12; }

.campo label {
    display: block;
    margin-bottom: 10px;
}

/* ---------- Campos ---------- */
.campo input[type=text],
.campo input[type=email],
.campo input[type=tel],
.campo select {
    display: block;
    width: 100%;
    height: 54px;
    margin: 0;
    padding: 0 22px;
    border: 1px solid var(--linha);
    border-radius: 999px;
    background-color: var(--fundo);
    color: var(--texto);
    font: inherit;
    transition: border-color .2s, box-shadow .2s;
}
.campo select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 48px;
    font-size: 14px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
}
.campo input:focus,
.campo select:focus,
.ficheiro:focus-within {
    outline: none;
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(32, 100, 242, .22);
}

/* Ficheiro: o input nativo fica por cima (transparente), os textos são sempre em português */
.ficheiro {
    position: relative;
    display: flex;
    align-items: center;
    height: 54px;
    padding: 0 11px;
    border: 1px solid var(--linha);
    border-radius: 5px;
    background: var(--fundo);
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
}
.ficheiro input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.ficheiro-btn {
    flex: none;
    padding: 7px 10px;
    background: var(--cinza);
    border-right: 1px solid var(--linha);
    color: var(--texto-2);
}
.ficheiro-nome {
    min-width: 0;
    margin-left: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--texto-2);
}
.ficheiro:hover .ficheiro-btn { background: #dfe0dc; }

/* ---------- Erros ---------- */
.erro-campo {
    margin: 6px 0 0;
    padding-left: 22px;
    color: var(--erro);
    font-size: 13px;
}
.erro-campo:empty { display: none; }
.campo input[aria-invalid=true],
.campo select[aria-invalid=true],
.ficheiro.invalido { border-color: var(--erro); }

.alerta {
    margin: 0 0 22px;
    padding: 12px 18px;
    border-radius: 14px;
    background: var(--erro-fundo);
    color: var(--erro);
    font-size: 15px;
}
.alerta:empty { display: none; }

/* ---------- Texto, consentimento e botão ---------- */
.ajuda { margin: 22px 0 0; }
.ajuda a { font-weight: 700; }

.consent {
    margin-top: 26px;
}
.consent input {
    width: 14px;
    height: 14px;
    margin: 0 6px 0 0;
    vertical-align: -2px;
    accent-color: var(--azul);
    cursor: pointer;
}
.consent .erro-campo { padding-left: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 18px;
    padding: 0 28px;
    border: 0;
    border-radius: 999px;
    background: var(--azul);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s;
}
.btn:hover { background: var(--azul-escuro); }
.btn:focus-visible { outline: 3px solid rgba(32, 100, 242, .35); outline-offset: 2px; }
.btn[disabled] { opacity: .7; cursor: progress; }

/* ---------- Agradecimento ---------- */
.obrigado {
    padding: 30px 10px 20px;
    text-align: center;
    outline: none;
}
.obrigado-icone { color: var(--azul); }
.obrigado h2 {
    margin: 18px auto 10px;
    max-width: 30ch;
    font-size: 24px;
    line-height: 1.3;
}
.obrigado p { margin: 0 auto; max-width: 52ch; }

/* ---------- Telemóvel ---------- */
@media (max-width: 640px) {
    .caixa { padding: 22px 18px 28px; border-radius: 22px; }
    .grelha { grid-template-columns: 1fr; }
    .c4, .c6, .c8, .c12 { grid-column: auto; }
    .campo select { font-size: 16px; }     /* evita o zoom automático no iOS */
    .obrigado h2 { font-size: 21px; }
}
