/*
 * TorrinhaMedia — Header Universal
 * TM UI Kit 1.0
 */

.tm-global-header {
    box-sizing: border-box;
    width: 100%;
    background: var(--tm-header-bg, #232329);
    color: var(--tm-header-text, #fff);
    font-family: var(--tm-font-family, Arial, sans-serif);
    border-bottom: 1px solid var(--tm-border, #454550);
    position: relative;
    z-index: 1000;
}

.tm-global-header *,
.tm-global-header *::before,
.tm-global-header *::after {
    box-sizing: border-box;
}

.tm-global-header.is-sticky {
    position: sticky;
    top: 0;
}

.tm-global-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 68px;
    padding: 10px 20px;
}

.tm-global-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    flex-shrink: 0;
}

.tm-global-brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.tm-global-brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tm-global-brand-name {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

.tm-global-brand-subtitle {
    font-size: 11px;
    opacity: .7;
}

.tm-global-nav {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.tm-global-nav a,
.tm-global-nav button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 12px;
    min-height: 40px;
    border: 0;
    border-radius: var(--tm-radius-md, 8px);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}

.tm-global-nav a:hover,
.tm-global-nav button:hover {
    background: rgba(128,128,128,.18);
}

.tm-global-nav .is-active {
    color: var(--tm-accent, #B51783);
    font-weight: 700;
}

.tm-global-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.tm-global-header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
    border: 0;
    border-radius: var(--tm-radius-md, 8px);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.tm-global-header-action:hover {
    background: rgba(128,128,128,.18);
}

.tm-global-mobile-toggle {
    display: none;
}

@media (max-width: 900px) {
    .tm-global-header-inner {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 14px;
    }

    .tm-global-mobile-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .tm-global-nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        order: 10;
    }

    .tm-global-header.is-menu-open .tm-global-nav {
        display: flex;
    }

    .tm-global-header-actions {
        margin-left: 0;
    }

    .tm-global-nav a,
    .tm-global-nav button {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tm-global-header * {
        scroll-behavior: auto;
    }
}

/* === TM GLOBAL DROPDOWNS V1 === */

.tm-global-nav-group {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tm-global-nav-dropdown-trigger {
    white-space: nowrap;
}

.tm-global-nav-dropdown-trigger[aria-expanded="true"] {
    background: rgba(128,128,128,.18);
}

.tm-global-nav-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1100;

    display: flex;
    flex-direction: column;
    gap: 3px;

    min-width: 210px;
    max-width: min(320px, 90vw);
    max-height: 70vh;
    overflow-y: auto;

    padding: 7px;

    background: var(--tm-surface, #fff);
    color: var(--tm-text, #22232A);

    border: 1px solid var(--tm-border, #ddd);
    border-radius: var(--tm-radius-md, 8px);

    box-shadow: var(
        --tm-shadow,
        0 4px 14px rgba(0,0,0,.15)
    );
}

.tm-global-nav-dropdown[hidden] {
    display: none !important;
}

.tm-global-nav-dropdown a {
    width: 100%;
    min-height: 38px;
    padding: 9px 12px;
    color: inherit;
    text-decoration: none;
    border-radius: var(--tm-radius-sm, 4px);
}

.tm-global-nav-dropdown a:hover {
    background: var(--tm-surface-alt, #eee);
}

.tm-global-nav a:focus-visible,
.tm-global-nav button:focus-visible,
.tm-global-mobile-toggle:focus-visible {
    outline: 2px solid var(--tm-accent, #B51783);
    outline-offset: 2px;
}

/* === TABLET E MOBILE === */

@media (max-width: 900px) {

    .tm-global-nav-group {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .tm-global-nav-dropdown {
        position: static;
        width: 100%;
        max-width: 100%;
        max-height: none;

        margin: 2px 0 8px;
        padding: 5px 5px 5px 15px;

        box-shadow: none;
        border-radius: 6px;
    }

    .tm-global-nav-dropdown-trigger {
        width: 100%;
        justify-content: space-between;
    }

    .tm-global-nav {
        max-height: 70vh;
        overflow-y: auto;
    }
}


/* === ÍCONES CENTRAIS TM BRANDING === */

.tm-global-icon-chevron,
.tm-global-icon-mobile {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.tm-global-icon-chevron {
    -webkit-mask-image: url('/branding/icons/svg/chevron-down.svg');
    mask-image: url('/branding/icons/svg/chevron-down.svg');
    transition: transform .2s ease;
}

.tm-global-nav-dropdown-trigger[aria-expanded="true"]
.tm-global-icon-chevron {
    transform: rotate(180deg);
}

.tm-global-icon-mobile {
    width: 20px;
    height: 20px;
    -webkit-mask-image: url('/branding/icons/svg/menu.svg');
    mask-image: url('/branding/icons/svg/menu.svg');
}

.tm-global-header.is-menu-open .tm-global-icon-mobile {
    -webkit-mask-image: url('/branding/icons/svg/x.svg');
    mask-image: url('/branding/icons/svg/x.svg');
}
