/* =====================================================================
   V41: exact header search/nav alignment + reroll button on winner card.
   Loaded after v40. Only overrides requested areas.
   ===================================================================== */

:root {
    --v41-header-brand: 330px;
    --v41-header-center: 680px;
    --v41-header-user-min: 320px;
}

.header,
body .header {
    overflow: visible !important;
}

.header .header-inner,
.header-inner {
    display: grid !important;
    grid-template-columns: var(--v41-header-brand) var(--v41-header-center) minmax(var(--v41-header-user-min), 1fr) !important;
    grid-template-rows: 40px 31px !important;
    grid-template-areas:
        "brand search user"
        "brand nav user" !important;
    column-gap: 18px !important;
    row-gap: 3px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 1500px !important;
    min-height: 86px !important;
    padding: 7px 18px 6px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

.header .header-brand,
.header-brand {
    grid-area: brand !important;
    width: var(--v41-header-brand) !important;
    max-width: var(--v41-header-brand) !important;
    justify-self: start !important;
    align-self: center !important;
}

.header .header-center,
.header-center {
    grid-area: search !important;
    width: var(--v41-header-center) !important;
    max-width: var(--v41-header-center) !important;
    min-width: 0 !important;
    justify-self: start !important;
    align-self: end !important;
    margin: 0 !important;
    transform: none !important;
}

.header .header-nav,
.header-inner > .header-nav,
.header #mainNavigation,
#mainNavigation {
    grid-area: nav !important;
    width: var(--v41-header-center) !important;
    max-width: var(--v41-header-center) !important;
    min-width: 0 !important;
    justify-self: start !important;
    align-self: start !important;
    margin: 0 !important;
    transform: none !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.header .search-section,
.header-center .search-section,
.search-section {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 37px !important;
    min-height: 37px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
}

.header .search-section input,
.header .search-section input[type="search"],
.header-center .search-section input,
.header-center .search-section input[type="search"],
#global-search-input {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    box-sizing: border-box !important;
}

.header .header-right,
.header-right {
    grid-area: user !important;
    justify-self: end !important;
    align-self: center !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Reroll button directly inside completed giveaway winner widget. */
.giveaway-winner.giveaway-winner-with-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 10px !important;
    align-items: center !important;
}

.giveaway-winner-main {
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.giveaway-winner-main > div {
    min-width: 0 !important;
}

.giveaway-card-reroll-btn {
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 10px !important;
    white-space: nowrap !important;
    justify-self: end !important;
}

.giveaway-card-reroll-btn[disabled] {
    opacity: .65 !important;
    cursor: wait !important;
}

@media (max-width: 1320px) {
    :root {
        --v41-header-brand: 300px;
        --v41-header-center: 620px;
        --v41-header-user-min: 260px;
    }

    .header .header-inner,
    .header-inner {
        column-gap: 14px !important;
    }
}

@media (max-width: 1120px) {
    .header .header-inner,
    .header-inner {
        grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(220px, auto) !important;
    }

    .header .header-center,
    .header-center,
    .header .header-nav,
    .header-inner > .header-nav,
    .header #mainNavigation,
    #mainNavigation {
        width: 100% !important;
        max-width: none !important;
    }
}

@media (max-width: 820px) {
    .header .header-inner,
    .header-inner {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto !important;
        grid-template-areas:
            "brand"
            "search"
            "nav" !important;
        gap: 8px !important;
        min-height: 0 !important;
    }

    .header .header-brand,
    .header-brand,
    .header .header-center,
    .header-center,
    .header .header-nav,
    .header-inner > .header-nav,
    .header #mainNavigation,
    #mainNavigation {
        width: 100% !important;
        max-width: none !important;
    }

    .header .header-right,
    .header-right {
        grid-area: brand !important;
        justify-self: end !important;
    }

    .giveaway-winner.giveaway-winner-with-actions {
        grid-template-columns: 1fr !important;
    }

    .giveaway-card-reroll-btn {
        width: 100% !important;
        justify-self: stretch !important;
    }
}
