/* ============================================================
   Impressora Online — cabeçalho, menu e rodapé (prefixo io-)
   Referência: PAGINA_PRINCIPAL/pagina-inicial.html
   ============================================================ */

:root {
    --io-brand: #1C6771;
    --io-brand-dark: #0F3E45;
    --io-brand-light: #E3F0F1;
    --io-brand-mid: #C5E0E3;
    --io-peach: #FDE7DA;
    --io-orange: #C2410C;
    --io-xmas: #7F1D1D;
    --io-xmas-card: #FDECEC;
    --io-xmas-link: #B91C1C;
    --io-sand: #F6F4F0;
    --io-line: #E7E2D9;
    --io-line-soft: #EFEBE4;
    --io-text-2: #4B5563;
    --io-text-3: #374151;
    --io-star: #B45309;
    --io-white: #FFFFFF;

    --io-font-head: 'Outfit', 'DM Sans', system-ui, sans-serif;
    --io-font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --io-max: 1280px;
    --io-gutter: 24px;
    --io-shadow-hover: 0 10px 24px rgba(15, 62, 69, .14);
}

/* O cabeçalho e o rodapé do WoodMart ficam escondidos onde este layout é usado */
body.io-layout header.whb-header,
body.io-layout footer.footer-container {
    display: none !important;
}

/* ---------- Base partilhada ---------- */
.io-topbar,
.io-header,
.io-drawer,
.io-drawer-overlay,
.io-footer,
.io-page {
    font-family: var(--io-font-body);
    color: var(--io-brand-dark);
    -webkit-font-smoothing: antialiased;
}

.io-topbar *, .io-topbar *::before, .io-topbar *::after,
.io-header *, .io-header *::before, .io-header *::after,
.io-drawer *, .io-drawer *::before, .io-drawer *::after,
.io-footer *, .io-footer *::before, .io-footer *::after,
.io-page *, .io-page *::before, .io-page *::after {
    box-sizing: border-box;
}

.io-header a,
.io-drawer a,
.io-page a {
    color: var(--io-brand-dark);
    text-decoration: none;
}

.io-header a:hover,
.io-drawer a:hover,
.io-page a:hover {
    color: var(--io-brand);
}

.io-header svg,
.io-drawer svg,
.io-footer svg,
.io-page svg {
    flex-shrink: 0;
}

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

.io-skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100000;
    background: var(--io-brand-dark);
    color: var(--io-white) !important;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
}

.io-skip-link:focus {
    top: 12px;
}

.io-header :focus-visible,
.io-drawer :focus-visible,
.io-footer :focus-visible,
.io-page :focus-visible {
    outline: 3px solid var(--io-brand);
    outline-offset: 2px;
}

.io-btn:hover {
    filter: brightness(.92);
}

/* ---------- Barra superior ---------- */
.io-topbar {
    background: var(--io-brand-dark);
    color: var(--io-white);
    font-size: 14px;
    line-height: 1.4;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 32px;
    text-align: center;
}

/* ---------- Cabeçalho ---------- */
.io-header {
    background: var(--io-white);
    border-bottom: 1px solid var(--io-line);
    position: relative;
    z-index: 50;
}

.io-header__row {
    max-width: var(--io-max);
    margin: 0 auto;
    padding: 18px var(--io-gutter);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 28px;
}

.io-logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.io-logo img {
    height: 28px;
    width: auto;
    max-width: none;
    display: block;
}

/* Pesquisa */
.io-search {
    flex: 1 1 320px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    background: var(--io-sand);
    border: 1px solid var(--io-line);
    border-radius: 999px;
    padding: 6px 6px 6px 18px;
}

.io-search input[type="search"] {
    flex: 1;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
    color: var(--io-brand-dark);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.io-search input[type="search"]::placeholder {
    color: #6B7280;
    opacity: 1;
}

.io-search:focus-within {
    border-color: var(--io-brand);
    box-shadow: 0 0 0 2px rgba(28, 103, 113, .25);
}

.io-search button.io-search__btn {
    width: 44px;
    height: 44px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--io-brand-dark);
    color: var(--io-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    text-transform: none;
    line-height: 1;
}

/* Sugestões da pesquisa */
.io-search__results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--io-white);
    border: 1px solid var(--io-line);
    border-radius: 18px;
    box-shadow: var(--io-shadow-hover);
    padding: 8px;
    max-height: 70vh;
    overflow-y: auto;
}

.io-search__results[hidden] {
    display: none;
}

.io-search__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
}

.io-search__item:hover,
.io-search__item:focus {
    background: var(--io-sand);
}

.io-search__thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--io-sand);
    overflow: hidden;
    flex: 0 0 48px;
}

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

.io-search__name {
    display: block;
    font-size: 14px;
    line-height: 1.3;
}

.io-search__price {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--io-brand);
}

.io-search__all,
.io-search__empty {
    display: block;
    padding: 10px 8px 4px;
    font-size: 14px;
    font-weight: 700;
}

.io-search__empty {
    font-weight: 500;
    color: var(--io-text-2);
}

/* Conta, contacto e carrinho */
.io-account-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.io-account-nav__link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.io-account-nav__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.io-account-nav__text strong {
    font-weight: 700;
}

.io-account-nav__sub {
    color: var(--io-text-2);
    font-size: 12px;
}

.io-cart {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--io-sand);
    display: flex;
    align-items: center;
    justify-content: center;
}

.io-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--io-brand);
    color: var(--io-white);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button.io-menu-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--io-line);
    border-radius: 999px;
    background: var(--io-white);
    color: var(--io-brand-dark);
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
    cursor: pointer;
}

/* ---------- Menu de categorias ---------- */
.io-nav {
    max-width: var(--io-max);
    margin: 0 auto;
    padding: 0 var(--io-gutter);
}

.io-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 28px;
    font-weight: 700;
    font-size: 15px;
}

.io-nav__item {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

.io-nav__item--end {
    margin-left: auto;
}

.io-nav__link,
.io-nav__item > details > summary {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
    color: var(--io-brand-dark);
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}

.io-nav__item > details > summary::-webkit-details-marker {
    display: none;
}

.io-nav__link:hover,
.io-nav__item > details > summary:hover,
.io-nav__item > details[open] > summary {
    color: var(--io-brand);
}

.io-nav__item--season .io-nav__link {
    color: var(--io-xmas-link);
}

.io-nav__item--end .io-nav__link {
    color: var(--io-text-2);
    font-weight: 500;
}

.io-nav__caret {
    width: 14px;
    height: 14px;
    transition: transform .18s ease;
}

details[open] > summary .io-nav__caret {
    transform: rotate(180deg);
}

.io-nav__panel {
    position: absolute;
    top: 100%;
    left: -18px;
    z-index: 70;
    min-width: 260px;
    background: var(--io-white);
    border: 1px solid var(--io-line);
    border-radius: 18px;
    box-shadow: var(--io-shadow-hover);
    padding: 12px;
}

.io-nav__panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.io-nav__panel li {
    margin: 0;
    list-style: none;
}

.io-nav__panel a {
    display: block;
    padding: 9px 12px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.3;
}

.io-nav__panel a:hover {
    background: var(--io-sand);
}

.io-nav__panel a.io-nav__all {
    font-weight: 700;
    color: var(--io-brand);
    border-bottom: 1px solid var(--io-line-soft);
    border-radius: 10px 10px 0 0;
    margin-bottom: 6px;
}

.io-nav__panel ul ul {
    padding-left: 12px;
}

/* ---------- Gaveta (menu no telemóvel) ---------- */
.io-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 62, 69, .45);
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

.io-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(360px, 88vw);
    background: var(--io-white);
    z-index: 99991;
    transform: translateX(-100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    visibility: hidden;
}

.io-drawer.is-open {
    transform: none;
    visibility: visible;
}

.io-drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

body.io-no-scroll {
    overflow: hidden;
}

.io-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--io-line);
    font-family: var(--io-font-head);
    font-weight: 700;
    font-size: 18px;
}

button.io-drawer__close {
    width: 44px;
    height: 44px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--io-sand);
    color: var(--io-brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
}

.io-drawer__nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.io-drawer__nav li {
    margin: 0;
    list-style: none;
    border-bottom: 1px solid var(--io-line-soft);
}

.io-drawer__nav ul ul li {
    border-bottom: 0;
}

.io-drawer__nav a,
.io-drawer__nav summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 16px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    list-style: none;
}

.io-drawer__nav summary::-webkit-details-marker {
    display: none;
}

.io-drawer__nav ul ul a {
    font-weight: 500;
    min-height: 44px;
    padding-left: 28px;
}

.io-drawer__nav ul ul ul a {
    padding-left: 40px;
}

.io-drawer__nav a.io-nav__all {
    color: var(--io-brand);
}

.io-drawer__nav .io-nav__item--season > a {
    color: var(--io-xmas-link);
}

.io-drawer__extra {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.io-drawer__extra a {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

/* ---------- Rodapé ---------- */
.io-footer {
    margin-top: 72px;
    background: var(--io-brand-dark);
    color: #E5E7EB;
}

.io-footer a {
    color: #E5E7EB;
    text-decoration: none;
}

.io-footer a:hover {
    color: var(--io-white);
    text-decoration: underline;
}

.io-footer__grid {
    max-width: var(--io-max);
    margin: 0 auto;
    padding: 48px var(--io-gutter) 28px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.io-footer__col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.io-footer__brand {
    grid-column: span 2;
}

.io-footer__logo {
    height: 40px;
    width: auto;
    max-width: none;
    align-self: flex-start;
    display: block;
}

.io-footer__title {
    margin: 0;
    color: var(--io-white);
    font-weight: 700;
    font-size: 14px;
    font-family: var(--io-font-body);
}

.io-footer__stores {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.io-footer__stores li {
    margin: 0;
    list-style: none;
}

.io-footer__stores strong {
    color: var(--io-white);
}

.io-footer__contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.io-footer__note {
    display: block;
    font-size: 12px;
    color: #C9D3D5;
}

.io-footer__social {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.io-footer__social a {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .1);
    color: var(--io-white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.io-footer__social a:hover {
    background: rgba(255, 255, 255, .2);
}

.io-footer__livro {
    display: inline-block;
    align-self: flex-start;
    background: var(--io-white);
    border-radius: 8px;
    padding: 4px 8px;
}

.io-footer__livro img {
    display: block;
    width: 85px;
    height: auto;
}

.io-footer__bottom {
    max-width: var(--io-max);
    margin: 0 auto;
    padding: 18px var(--io-gutter) 28px;
    border-top: 1px solid rgba(255, 255, 255, .15);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.io-footer__pay {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.io-footer__pay span {
    background: var(--io-white);
    color: var(--io-brand-dark);
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
}

/* ---------- Responsivo ---------- */
@media (max-width: 1024px) {
    .io-nav {
        display: none;
    }

    button.io-menu-toggle {
        display: inline-flex;
    }

    .io-header__row {
        flex-wrap: nowrap;
        gap: 16px;
    }

    .io-search {
        flex: 1 1 200px;
        min-width: 0;
    }

    .io-account-nav {
        gap: 12px;
        flex: 0 0 auto;
    }

    .io-account-nav__text {
        display: none;
    }

    .io-account-nav__link {
        width: 44px;
        justify-content: center;
        border-radius: 12px;
        background: var(--io-sand);
    }
}

@media (max-width: 900px) {
    .io-header__row {
        flex-wrap: wrap;
    }

    .io-account-nav {
        margin-left: auto;
    }

    .io-search {
        order: 3;
        flex: 1 1 100%;
    }
}

@media (max-width: 720px) {
    :root {
        --io-gutter: 16px;
    }

    .io-topbar {
        font-size: 13px;
        gap: 4px 20px;
        padding: 8px 12px;
    }

    .io-header__row {
        flex-wrap: wrap;
        padding-top: 12px;
        padding-bottom: 12px;
        gap: 12px;
    }

    .io-logo img {
        height: 22px;
    }

    .io-account-nav {
        margin-left: auto;
        gap: 8px;
    }

    .io-search {
        order: 3;
        flex: 1 1 100%;
    }

    .io-footer__brand {
        grid-column: auto;
    }
}

@media (max-width: 420px) {
    .io-account-nav__link--contact {
        display: none;
    }

    button.io-menu-toggle span {
        display: none;
    }

    button.io-menu-toggle {
        width: 44px;
        padding: 0;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .io-drawer,
    .io-drawer-overlay,
    .io-nav__caret {
        transition: none;
    }
}
