/* portal.css — estilos do formulário e layout base */

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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green-900: #0d3b1e;
    --green-700: #1a6e3a;
    --green-500: #27a85a;
    --green-300: #6dd49a;
    --green-100: #e8f8ee;
    --text-primary:   #1a1a1a;
    --text-secondary: #555;
    --text-muted:     #999;
    --bg:       #f5faf7;
    --white:    #fff;
    --border:   #d4ead9;
    --border-input: #c8d5cc;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 24px rgba(27, 110, 58, .09);
}

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
}

.brand-icon { font-size: 22px; }
.brand-logo { height: 32px; width: auto; display: block; }

.header-tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--green-700);
    background: var(--green-100);
    border: 1px solid var(--green-300);
    padding: 3px 10px;
    border-radius: 20px;
}

/* ── Layout principal ────────────────────────────────────────────────────── */
.portal-page { min-height: 100vh; }

.portal-main {
    display: flex;
    justify-content: center;
    padding: 36px 16px 64px;
}

.portal-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 36px 36px 40px;
    max-width: 560px;
    width: 100%;
}

.card-intro {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.card-intro h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--green-900);
    margin-bottom: 8px;
}

.card-intro p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Alertas ─────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
}
.alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

/* ── Campos de formulário ────────────────────────────────────────────────── */
.field-group { margin-bottom: 18px; }

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: .02em;
}

.required { color: #dc2626; margin-left: 2px; }

.field-hint {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 6px;
    font-size: 11px;
}

input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(39, 168, 90, .12);
}

input::placeholder { color: var(--text-muted); }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Combobox de busca ───────────────────────────────────────────────────── */
.combobox-wrap {
    position: relative;
}

.combobox-field {
    position: relative;
    display: flex;
    align-items: center;
}

.combobox-input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}

.combobox-input:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(39, 168, 90, .12);
}

.combobox-input::placeholder { color: var(--text-muted); }

.combobox-chevron {
    position: absolute;
    right: 12px;
    width: 12px;
    height: 8px;
    color: var(--text-muted);
    pointer-events: none;
    transition: transform .15s;
}

.combobox-wrap.open .combobox-chevron {
    transform: rotate(180deg);
}

.combobox-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
    padding: 4px;
    margin: 0;
}

.combobox-list li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    transition: background .1s;
}

.combobox-list li:hover,
.combobox-list li.highlighted {
    background: var(--green-100);
}

.combobox-list li.combobox-empty {
    color: var(--text-muted);
    cursor: default;
    font-style: italic;
    justify-content: center;
}
.combobox-list li.combobox-empty:hover { background: none; }

.cb-title {
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.cb-cidade {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Destino selecionado — aparece abaixo do campo após seleção */
.destino-selected {
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--green-100);
    border: 1px solid var(--green-300);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-top: 6px;
    font-size: 13px;
}

.destino-selected strong { color: var(--green-900); font-weight: 600; }
.destino-selected small  { font-size: 11px; color: var(--green-700); margin-left: 4px; }

.destino-selected-clear {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.destino-selected-clear:hover { color: var(--text-primary); }

/* ── Destino locked ──────────────────────────────────────────────────────── */
.destino-locked {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--green-100);
    border: 1px solid var(--green-300);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--green-900);
}
.destino-locked strong { display: block; font-weight: 600; }
.destino-locked small  { font-size: 12px; color: var(--green-700); }
.destino-locked-icon   { font-size: 20px; }
.destino-locked-badge  {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--green-700);
    opacity: .7;
}

/* ── Dropzone ────────────────────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-md);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--white);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--green-500);
    background: var(--green-100);
}

.dropzone-icon { font-size: 36px; margin-bottom: 8px; }
.dropzone-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.dropzone-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.dropzone-link { color: var(--green-700); text-decoration: underline; cursor: pointer; }

/* Prévia de fotos selecionadas */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    text-align: left;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    line-height: 1;
}

.preview-add {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px dashed var(--border-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    background: var(--white);
    transition: border-color .15s, background .15s;
}
.preview-add:hover {
    border-color: var(--green-500);
    background: var(--green-100);
}

/* ── Termo de cessão ─────────────────────────────────────────────────────── */
.cessao-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f9fafb;
    padding: 16px;
    margin-bottom: 20px;
}

.cessao-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cessao-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.65;
    max-height: 88px;
    overflow-y: auto;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--white);
}

.cessao-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    cursor: pointer;
}

.cessao-check input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--green-700);
}

/* ── Botão de envio ──────────────────────────────────────────────────────── */
.btn-submit {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--green-700);
    color: var(--white);
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s;
    margin-bottom: 14px;
}

.btn-submit:hover:not(:disabled) { background: var(--green-900); }
.btn-submit:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ── Nota de privacidade ─────────────────────────────────────────────────── */
.privacy-note {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .portal-card { padding: 24px 16px 28px; }
    .fields-row  { grid-template-columns: 1fr; gap: 0; }
    .preview-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Dados do destino (seção opcional colapsável — modo público) */
.dados-destino{border:1px solid #e2e8e0;border-radius:12px;margin-bottom:20px;background:#fafcfb;}
.dados-destino>summary{cursor:pointer;padding:14px 16px;display:flex;flex-direction:column;gap:2px;list-style:none;}
.dados-destino>summary::-webkit-details-marker{display:none;}
.dados-destino>summary>span{font-weight:600;color:var(--green-700,#1e6b3a);}
.dados-destino>summary em{font-weight:400;font-style:normal;color:#8a8475;}
.dados-destino>summary small{color:#8a8475;font-size:12px;}
.dados-destino[open]>summary{border-bottom:1px solid #e2e8e0;}
.dados-destino-body{padding:16px;}
.dados-destino-body textarea{width:100%;font-family:inherit;font-size:15px;padding:10px 12px;border:1px solid #cfd8d3;border-radius:8px;resize:vertical;box-sizing:border-box;}

/* Seções de peso equivalente (modo gerente / token): informações + fotos */
.form-section{border:1px solid #e2e8e0;border-radius:12px;margin-bottom:20px;padding:18px 16px;background:#fafcfb;}
.section-heading{font-size:16px;font-weight:600;color:var(--green-900,#0d3b1e);margin:0 0 2px;}
.section-opt{font-size:12px;font-weight:400;color:#8a8475;}
.section-sub{font-size:13px;color:var(--text-secondary,#555);margin:0 0 14px;}
.form-section .field-group:last-child{margin-bottom:0;}
.form-section textarea{width:100%;font-family:inherit;font-size:15px;padding:10px 12px;border:1px solid #cfd8d3;border-radius:8px;resize:vertical;box-sizing:border-box;}
