/* ==========================================================================
   Kivembasoft — cabeçalho do WHMCS (tema Twenty-One)
   Estados: transparente | hover (azul) | megamenu aberto | fixo no scroll
   ========================================================================== */

:root {
    --ks-blue: #0e3661;                       /* barra no hover */
    --ks-panel: rgba(12, 52, 94, .97);        /* megamenu / painéis */
    --ks-fixed-a: rgba(11, 54, 101, .96);     /* barra fixa (esquerda) */
    --ks-fixed-b: rgba(6, 40, 75, .96);       /* barra fixa (direita) */
    --ks-line: rgba(255, 255, 255, .12);
    --ks-soft: rgba(255, 255, 255, .82);
    --ks-accent: #7fd6ff;
    --ks-bar-h: 92px;
    --ks-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Faixa azul no topo da página, por trás do cabeçalho transparente ---------- */
#main-body.ks-main {
    position: relative;
    padding-top: var(--ks-bar-h);
    background:
        linear-gradient(180deg, #021a31 0%, #052849 100%) top / 100% var(--ks-bar-h) no-repeat,
        #f4f6fa;
}
.ks-main > .master-breadcrumb {
    position: relative;
    margin: 0;
    padding: 18px 0 40px;
    border: 0;
    background:
        radial-gradient(1000px 320px at 80% 75%, rgba(42, 107, 189, .28), transparent 70%),
        linear-gradient(180deg, #052849 0%, #0d3a6d 100%);
    font-family: var(--ks-font);
}
.ks-main > .master-breadcrumb .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin: 0;
    padding: 0;
    background: transparent;
    font-size: 13.5px;
}
.ks-main > .master-breadcrumb .breadcrumb-item,
.ks-main > .master-breadcrumb .breadcrumb-item a { color: rgba(255, 255, 255, .65); }
.ks-main > .master-breadcrumb .breadcrumb-item a:hover { color: #fff; text-decoration: none; }
.ks-main > .master-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: rgba(255, 255, 255, .3); content: "›"; }
/* O último item (página atual) aparece como título da página, com o traço ciano da marca */
.ks-main > .master-breadcrumb .breadcrumb-item.active {
    display: block;
    flex: 0 0 100%;
    margin-top: 8px;
    padding-left: 0;
    overflow: hidden;
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ks-main > .master-breadcrumb .breadcrumb-item.active::before { display: none; }
.ks-main > .master-breadcrumb .breadcrumb-item.active::after {
    content: "";
    display: block;
    width: 44px;
    height: 4px;
    margin-top: 14px;
    border-radius: 999px;
    background: #1cf7e9;
}
/* Espaço para a folha de conteúdo subir por cima da faixa (só quando vem logo a seguir) */
.ks-main > .master-breadcrumb:has(+ .container) { padding-bottom: 92px; }
@media (max-width: 575.98px) {
    .ks-main > .master-breadcrumb:has(+ .container) { padding-bottom: 72px; }
    .ks-main > .master-breadcrumb .breadcrumb-item.active { font-size: 27px; }
}

/* ---------- Cabeçalho ---------- */
#header.ks-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #fff;
    font-family: var(--ks-font);
    -webkit-font-smoothing: antialiased;
}
.ks-header *, .ks-header *::before, .ks-header *::after { box-sizing: border-box; }
.ks-header [hidden] { display: none !important; }
.ks-header a { text-decoration: none; }

.ks-header__bar {
    position: relative;
    border-bottom: 1px solid transparent;
    transition: background-color .25s ease, border-color .25s ease;
}
.ks-header__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 24px;
    max-width: 1320px;
    height: var(--ks-bar-h);
    margin: 0 auto;
    padding: 0 15px;
    /* linha fina por baixo do menu, só na largura do conteúdo */
    background-image: linear-gradient(var(--ks-line), var(--ks-line));
    background-size: calc(100% - 30px) 1px;
    background-position: center bottom;
    background-repeat: no-repeat;
}

/* Hover, painel aberto ou menu móvel aberto: barra azul */
.ks-header:hover .ks-header__bar,
.ks-header.is-open .ks-header__bar,
.ks-header.is-menu-open .ks-header__bar {
    background-color: var(--ks-blue);
    border-bottom-color: rgba(255, 255, 255, .08);
}
.ks-header:hover .ks-header__inner,
.ks-header.is-open .ks-header__inner,
.ks-header.is-menu-open .ks-header__inner,
.ks-header.is-fixed .ks-header__inner { background-image: none; }

/* Fixo ao fazer scroll */
#header.ks-header.is-fixed {
    position: fixed;
    animation: ksSlideDown .35s ease both;
}
.ks-header.is-fixed .ks-header__bar,
.ks-header.is-fixed:hover .ks-header__bar {
    background: linear-gradient(90deg, var(--ks-fixed-a), var(--ks-fixed-b));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom-color: rgba(255, 255, 255, .06);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
}
@keyframes ksSlideDown { from { transform: translateY(-100%); } to { transform: none; } }
@keyframes ksFade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Logótipo */
.ks-logo { justify-self: start; display: inline-flex; align-items: center; }
.ks-logo img { display: block; height: 48px; width: auto; }

/* ---------- Menu principal ---------- */
.ks-nav { justify-self: center; }
.ks-menu {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ks-menu > li > a,
.ks-menu__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 0;
    background: none;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -.005em;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s ease;
}
.ks-menu > li > a:hover,
.ks-menu > li > a:focus,
.ks-menu__toggle:hover,
.ks-menu__toggle[aria-expanded="true"] { color: var(--ks-accent); outline: 0; }
.ks-menu__toggle:focus-visible,
.ks-menu > li > a:focus-visible,
.ks-icon-btn:focus-visible,
.ks-btn-outline:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }

.ks-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform .2s ease;
}
.ks-menu__toggle[aria-expanded="true"] .ks-caret { transform: rotate(180deg); }
.ks-nav__cta { display: none; }

/* ---------- Ações à direita ---------- */
.ks-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ks-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin-right: 12px;
    padding: 0 15px;
    border: 2px solid #fff;
    border-radius: 2px;
    color: #fff !important;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color .2s ease, color .2s ease;
}
.ks-btn-outline:hover { background: #fff; color: var(--ks-blue) !important; }

.ks-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff !important;
    cursor: pointer;
    transition: background-color .2s ease;
}
.ks-icon-btn:hover,
.ks-icon-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .12); }
.ks-icon-btn svg { width: 21px; height: 21px; display: block; }
.ks-badge {
    position: absolute;
    top: 1px;
    right: -1px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #29a8e0;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
}
.ks-badge--alert { background: #e5484d; }
.ks-badge--empty { display: none; }
.ks-burger { display: none; }
.ks-burger .ks-ico-close { display: none; }
.ks-header.is-menu-open .ks-burger .ks-ico-open { display: none; }
.ks-header.is-menu-open .ks-burger .ks-ico-close { display: block; }

/* ---------- Megamenu e painéis ---------- */
.ks-mega,
.ks-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ks-panel);
    border-top: 1px solid rgba(255, 255, 255, .05);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 32px rgba(0, 0, 0, .2);
    animation: ksFade .2s ease both;
}
.ks-mega__inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    row-gap: 32px;
    width: min(1710px, calc(100% - 64px));
    margin: 0 auto;
    padding: 72px 0 64px;
}
.ks-mega__intro { padding-right: 20px; }
.ks-mega__intro h3 {
    margin: 0 0 14px;
    color: #fff;
    font-family: inherit;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -.01em;
}
.ks-mega__intro p {
    max-width: 560px;
    margin: 0;
    color: var(--ks-soft);
    font-size: 16px;
    line-height: 1.75;
}
.ks-mega__col h4 {
    margin: 4px 0 12px;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}
.ks-mega__col ul { margin: 0; padding: 0; list-style: none; }
.ks-mega__col li a {
    display: inline-block;
    padding: 3px 0;
    color: var(--ks-soft);
    font-size: 16px;
    line-height: 1.6;
    transition: color .15s ease, transform .15s ease;
}
.ks-mega__col li a:hover { color: #fff; transform: translateX(3px); }

/* Painel de pesquisa */
.ks-panel--search .ks-mega__inner { display: block; max-width: 900px; padding: 48px 0; }
.ks-search {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid rgba(255, 255, 255, .5);
}
.ks-search:focus-within { border-bottom-color: #fff; }
.ks-search svg { width: 22px; height: 22px; flex: none; color: var(--ks-soft); }
.ks-search input {
    flex: 1;
    min-width: 0;
    height: 56px;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    font-family: inherit;
    font-size: 22px;
    outline: 0;
}
.ks-search input::placeholder { color: rgba(255, 255, 255, .55); }
.ks-search button {
    height: 40px;
    padding: 0 18px;
    border: 2px solid #fff;
    border-radius: 2px;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.ks-search button:hover { background: #fff; color: var(--ks-blue); }

/* ---------- Utilizador: menu pequeno (igual ao do WordPress) ---------- */
.ks-user { position: relative; }
.ks-user:hover > .ks-icon-btn,
.ks-user:focus-within > .ks-icon-btn { background: rgba(255, 255, 255, .12); }
.ks-drop {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 5;
    min-width: 220px;
    max-width: 300px;
    max-height: calc(100vh - var(--ks-bar-h) - 20px);
    overflow-y: auto;
    margin-top: 10px;
    padding: 8px 0;
    background: rgba(12, 52, 94, .97);
    border-radius: 4px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, .25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
/* ponte invisível para o menu não fechar entre o ícone e a caixa */
.ks-user::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 12px;
}
.ks-user:hover .ks-drop,
.ks-user:focus-within .ks-drop {
    opacity: 1;
    visibility: visible;
    transform: none;
}
.ks-drop a {
    display: block;
    padding: 9px 18px;
    color: rgba(255, 255, 255, .85) !important;
    font-size: 15px;
    line-height: 1.4;
    white-space: nowrap;
}
.ks-drop a:hover { color: #fff !important; background: rgba(255, 255, 255, .08); }
.ks-drop hr { margin: 6px 0; border: 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.ks-drop__head { padding: 8px 18px 10px; margin-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.ks-drop__head span { display: block; color: rgba(255, 255, 255, .6); font-size: 12px; }
.ks-drop__head strong { display: block; color: #fff; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-drop a.ks-drop__alert { display: flex; gap: 8px; align-items: flex-start; white-space: normal; font-size: 13px; color: rgba(255, 255, 255, .8) !important; }
.ks-drop .ks-dot { flex: none; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: #3ec27a; }
.ks-drop .ks-alert--danger .ks-dot { background: #ff6b6b; }
.ks-drop .ks-alert--warning .ks-dot { background: #ffc24b; }
.ks-drop .ks-alert--info .ks-dot { background: #4fc3f7; }

/* ---------- Ecrãs médios: menos espaço ---------- */
@media (max-width: 1399.98px) {
    .ks-menu > li > a, .ks-menu__toggle { padding: 10px 8px; font-size: 14.5px; }
    .ks-btn-outline { margin-right: 6px; }
}

/* ---------- Tablet e telemóvel ---------- */
@media (max-width: 1199.98px) {
    :root { --ks-bar-h: 76px; }
    .ks-header__inner { grid-template-columns: auto 1fr; }
    .ks-logo img { height: 42px; }
    .ks-burger { display: inline-flex; }

    .ks-nav {
        justify-self: stretch;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        display: none;
        max-height: calc(100vh - var(--ks-bar-h));
        overflow-y: auto;
        padding: 6px 0 20px;
        background: var(--ks-blue);
        border-top: 1px solid rgba(255, 255, 255, .08);
        box-shadow: 0 24px 40px rgba(0, 0, 0, .3);
    }
    .ks-header.is-menu-open .ks-nav { display: block; }
    .ks-menu { flex-direction: column; align-items: stretch; }
    .ks-menu > li > a,
    .ks-menu__toggle {
        width: 100%;
        justify-content: space-between;
        padding: 16px 20px;
        font-size: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, .07);
    }
    .ks-nav .ks-mega {
        position: static;
        background: rgba(0, 0, 0, .18);
        border: 0;
        box-shadow: none;
        animation: none;
    }
    .ks-nav .ks-mega__inner { grid-template-columns: 1fr; row-gap: 18px; width: auto; padding: 18px 20px 14px 32px; }
    .ks-nav .ks-mega__intro { display: none; }
    .ks-nav .ks-mega__col li a { font-size: 15px; }
    .ks-nav__cta { display: block; padding: 20px 20px 0; }
    .ks-nav__cta .ks-btn-outline { width: 100%; height: 44px; margin: 0; }
    .ks-actions .ks-btn-outline { display: none; }

    .ks-panel { max-height: calc(100vh - var(--ks-bar-h)); overflow-y: auto; }
    .ks-panel--search .ks-mega__inner { width: auto; padding: 28px 20px; }
    .ks-search input { font-size: 18px; }
}
@media (max-width: 575.98px) {
    .ks-mega__intro h3 { font-size: 22px; }
    .ks-actions { gap: 2px; }
    .ks-search button { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    #header.ks-header.is-fixed, .ks-mega, .ks-panel { animation: none; }
}
