/* ============================================================
   Portal Auth Pages — Login & Registo
   Split-screen: navy left panel + white right form
   ============================================================ */

/* ---- Reset for auth pages ---- */
.portal-body {
    background: #f7f4ee;
    min-height: 100vh;
}

/* Hide default portal header/footer on auth pages */
.portal-site-header,
.portal-footer {
    display: none !important;
}

/* ============================================================
   AUTH WRAP — full-screen split layout
   ============================================================ */
.auth-wrap {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   LEFT PANEL — navy + gold
   ============================================================ */
.auth-left {
    flex: 1;
    min-width: 0;
    background:
        radial-gradient(circle at 15% 15%, rgba(231,120,34,0.10) 0%, transparent 45%),
        linear-gradient(165deg, #24235e 0%, #171647 55%, #071a33 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 40px 48px;
    overflow: hidden;
}

/* Decorative background pattern */
.auth-left-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 85%, rgba(231,120,34, 0.14) 0%, transparent 50%),
        radial-gradient(circle at 85% 12%, rgba(255,255,255,0.05) 0%, transparent 50%);
    pointer-events: none;
}
.auth-left-pattern::before {
    content: '';
    position: absolute;
    bottom: -70px;
    right: -70px;
    width: 280px;
    height: 280px;
    border: 1px solid rgba(231,120,34,0.18);
    border-radius: 50%;
}
.auth-left-pattern::after {
    content: '';
    position: absolute;
    bottom: -120px;
    right: -120px;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(231,120,34,0.09);
    border-radius: 50%;
}
/* Fine dot-grid texture, top-left corner, for extra depth */
.auth-left-pattern .auth-dotgrid {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 180px;
    height: 180px;
    background-image: radial-gradient(rgba(255,255,255,0.10) 1.5px, transparent 1.5px);
    background-size: 18px 18px;
    opacity: 0.6;
}

/* Main block (badge + brand + features) — vertically centred as a group,
   leaving the footer pinned to the very bottom (see .auth-left-footer). */
.auth-left-main {
    position: relative;
    z-index: 2;
    margin: auto 0;
    text-align: center;
    animation: authFadeUp .6s ease both;
}

/* Logo/nome/descrição do painel esquerdo só aparecem em telemóvel (ver
   RESPONSIVE) — em ecrãs maiores essa informação já vai por cima do
   formulário (.auth-card-brand), não precisa de estar duplicada aqui. */
.auth-badge {
    display: none;
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(255,255,255,0.16), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.16);
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 32px rgba(0,0,0,0.28);
    padding: 14px;
    text-decoration: none;
}
.auth-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-brand-name {
    display: none;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.5px;
    line-height: 1.25;
    margin: 0 auto 10px;
    max-width: 320px;
}
.auth-brand-tagline {
    display: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: rgba(255,255,255,0.6);
    margin: 0 auto 34px;
    max-width: 300px;
    line-height: 1.5;
}

/* Feature list — boxed cards */
.auth-features {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}
.auth-features li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 14px;
    padding: 13px 16px;
    transition: background 0.2s, border-color 0.2s;
}
.auth-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 11px;
    background: rgba(231,120,34,0.16);
    border: 1px solid rgba(231,120,34,0.26);
    color: #e77822;
    font-size: 16px;
}
.auth-feature-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
}
.auth-feature-text strong {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}
.auth-feature-text small {
    color: rgba(255,255,255,0.55);
    font-size: 12.5px;
    line-height: 1.5;
}

/* Footer copyright — pinned to the bottom of the panel */
.auth-left-footer {
    position: relative;
    z-index: 2;
    text-align: center;
    font-size: 11.5px;
    line-height: 1.7;
    color: rgba(255,255,255,0.35);
    padding-top: 24px;
}

@keyframes authFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RIGHT PANEL — white form area
   ============================================================ */
.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f4ee;
    padding: 40px 24px;
}

.auth-form-wrap {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 22px;
    padding: 46px 42px;
    box-shadow: 0 20px 60px -12px rgba(23,22,71,0.18), 0 2px 8px rgba(23,22,71,0.06);
    animation: authFadeUp .6s ease .12s both;
    overflow: hidden;
}
.auth-form-wrap::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #171647 0%, #e77822 100%);
}
.auth-form-wrap--wide {
    max-width: 520px;
}

/* Form header */
.auth-form-header {
    margin-bottom: 28px;
    text-align: center;
}

/* Brand header shown above the form itself (login/registo), so the card
   never starts abruptly with just the fields — same content as the left
   panel, condensed. Hidden on mobile, where the top section already
   shows it (see RESPONSIVE section). */
.auth-card-brand {
    text-align: center;
    margin-bottom: 26px;
    padding-bottom: 24px;
    border-bottom: 1px solid #eef0f3;
}
.auth-card-brand-logo {
    display: block;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: linear-gradient(160deg, #24235e, #171647);
    padding: 10px;
    object-fit: contain;
    box-shadow: 0 8px 20px rgba(23,22,71,0.22);
}
.auth-card-brand h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: #171647;
    margin: 0 0 6px;
}
.auth-card-brand p {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}
.auth-form-header h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #171647;
    margin-bottom: 6px;
}
.auth-form-header p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Alert */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    color: #dc2626;
    margin-bottom: 22px;
}
.auth-alert i {
    flex-shrink: 0;
    font-size: 16px;
}

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Two-column row */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Field */
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.auth-field label {
    font-size: 12.5px;
    font-weight: 700;
    color: #171647;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Input with icon */
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-input-wrap > i {
    position: absolute;
    left: 14px;
    color: #9ca3af;
    font-size: 15px;
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s;
}
.auth-input-wrap input {
    width: 100%;
    height: 48px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 0 16px 0 42px;
    font-size: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #171647;
    background: #f9fafb;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.auth-input-wrap input::placeholder {
    color: #b0b6bf;
}
.auth-input-wrap input:focus {
    border-color: #e77822;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(231,120,34,0.14);
}
.auth-input-wrap input:focus + i,
.auth-input-wrap:focus-within > i {
    color: #e77822;
}

/* Botão mostrar/ocultar senha */
.auth-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
    z-index: 2;
}
.auth-eye:hover {
    color: #171647;
}
.auth-input-wrap:has(.auth-eye) input {
    padding-right: 42px;
}

/* Submit button */
.auth-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, #f2a51f 0%, #e77822 55%, #c9651a 100%);
    color: #171647;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
    margin-top: 6px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: 0.3px;
    box-shadow: 0 8px 20px rgba(231,120,34,0.32);
}
.auth-btn-primary:hover {
    filter: brightness(1.04);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(231,120,34,0.4);
}
.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(231,120,34,0.22);
}
.auth-btn-primary i {
    font-size: 16px;
    transition: transform 0.2s;
}
.auth-btn-primary:hover i {
    transform: translateX(4px);
}
/* Divider "ou" */
.auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: #e5e7eb;
}
.auth-divider span { font-size: 12px; color: #9ca3af; font-weight: 600; white-space: nowrap; }

/* Footer link */
.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
    font-size: 14px;
    color: #6b7280;
}
.auth-footer a {
    color: #e77822;
    font-weight: 700;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.auth-footer a:hover {
    color: #171647;
}

/* Back link */
.auth-back {
    text-align: center;
    margin-top: 14px;
}
.auth-back a {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s, transform 0.2s;
}
.auth-back a:hover {
    color: #171647;
    transform: translateX(-2px);
}

/* Helper line at the very bottom of the card */
.auth-help {
    text-align: center;
    font-size: 12px;
    color: #b0b6bf;
    margin: 18px 0 0;
}
.auth-help a {
    color: #9ca3af;
    font-weight: 600;
    text-decoration: underline;
}
.auth-help a:hover {
    color: #171647;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
    .auth-left {
        padding: 36px 32px;
    }
    .auth-brand-name {
        font-size: 26px;
    }
    .auth-form-wrap {
        padding: 38px 30px;
    }
}

@media (max-width: 767px) {
    .portal-body {
        padding: 24px 14px;
    }
    .auth-wrap {
        flex-direction: column;
        max-width: 460px;
        min-height: 0;
        margin: 0 auto;
        background: #fff;
        border-radius: 22px;
        box-shadow: 0 20px 60px -12px rgba(23,22,71,0.18), 0 2px 8px rgba(23,22,71,0.06);
        overflow: hidden;
    }
    .auth-card-brand {
        display: none;
    }

    /* Logo section becomes a plain light header instead of the navy panel */
    .auth-left {
        flex: none;
        min-height: auto;
        background: none;
        padding: 36px 28px 24px;
        border-bottom: 1px solid #eef0f3;
    }
    .auth-left-pattern {
        display: none;
    }
    .auth-left-main {
        margin: 0;
        animation: none;
    }
    .auth-badge {
        display: flex;
        width: 56px;
        height: 56px;
        margin: 0 auto 12px;
        background: linear-gradient(160deg, #24235e, #171647);
        border: none;
        box-shadow: 0 8px 20px rgba(23,22,71,0.28);
    }
    .auth-brand-name {
        display: block;
        color: #171647;
        font-size: 19px;
        margin: 0 auto 4px;
    }
    .auth-brand-tagline {
        display: block;
        color: #6b7280;
        font-size: 12px;
        margin: 0 auto;
    }
    .auth-features,
    .auth-left-footer {
        display: none;
    }

    /* Form sits directly below, as one continuous card */
    .auth-right {
        background: none;
        padding: 26px 26px 32px;
        align-items: flex-start;
    }
    .auth-form-wrap {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        max-width: 100%;
        animation: none;
    }
    .auth-form-wrap::before {
        display: none;
    }
    .auth-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-left-main, .auth-form-wrap {
        animation: none;
    }
}

/* ============================================================
   MODAL — Termos de Serviço / Política de Privacidade
   ============================================================ */
.papp-modal-overlay[hidden] {
    display: none;
}
.papp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(23,22,71,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}
.papp-modal-box {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(23,22,71,0.35);
}
.papp-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #eef0f3;
}
.papp-modal-head h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #171647;
    margin: 0;
}
.papp-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
}
.papp-modal-close:hover {
    color: #171647;
}
.papp-modal-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 22px 0;
    border-bottom: 1px solid #eef0f3;
}
.papp-modal-tab {
    background: none;
    border: none;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    margin-bottom: -1px;
}
.papp-modal-tab.active {
    color: #171647;
    border-bottom-color: #e77822;
}
.papp-modal-body {
    flex: 1;
    min-height: 0;
    background: #f7f4ee;
}
.papp-modal-body iframe {
    width: 100%;
    height: 100%;
    min-height: 320px;
    border: 0;
    display: block;
}
.papp-modal-foot {
    padding: 16px 22px;
    border-top: 1px solid #eef0f3;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.papp-modal-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}
.papp-modal-check input {
    width: 16px;
    height: 16px;
    accent-color: #e77822;
    flex-shrink: 0;
}
.papp-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.papp-modal-btn {
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: filter .2s, opacity .2s;
}
.papp-modal-btn--ghost {
    background: #fff;
    border-color: #e5e7eb;
    color: #6b7280;
}
.papp-modal-btn--ghost:hover {
    background: #f7f4ee;
}
.papp-modal-btn--primary {
    background: linear-gradient(135deg, #f2a51f 0%, #e77822 55%, #c9651a 100%);
    color: #171647;
}
.papp-modal-btn--primary:hover:not(:disabled) {
    filter: brightness(1.05);
}
.papp-modal-btn--primary:disabled {
    opacity: .5;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .papp-modal-box {
        max-height: 92vh;
    }
    .papp-modal-actions {
        justify-content: stretch;
    }
    .papp-modal-actions .papp-modal-btn {
        flex: 1;
    }
}

/* BGC — logótipo (JPG com fundo branco) num cartão branco */
.auth-badge img { background: #fff; border-radius: 16px; padding: 6px 8px; }
.auth-card-brand-logo { background: #fff; border-radius: 14px; padding: 4px 6px; }

/* BGC — letra de todo o ecrã de entrada */
body, button, input, select, textarea { font-family: 'Plus Jakarta Sans', sans-serif; }
