/**
 * Header Styles
 *
 * @package Rezeta
 */

/* ==========================================================================
   Header Base
   ========================================================================== */
.rezeta-header {
    position: relative;
    z-index: 100;
}

.rezeta-header--default {
    background-color: var(--rezeta-header-bg, #ffffff);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.rezeta-header-inner {
    padding-top: var(--rezeta-header-padding-top, 15px);
    padding-bottom: var(--rezeta-header-padding-bottom, 15px);
}

/* ==========================================================================
   Header Main Layout
   ========================================================================== */
.rezeta-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.rezeta-header-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ==========================================================================
   Logo
   ========================================================================== */
.rezeta-header-logo {
    flex-shrink: 0;
}

.rezeta-logo {
    display: inline-block;
    line-height: 1;
}

.rezeta-logo img {
    display: block;
    height: auto;
    /* Allow height to adjust if width is constrained */
    max-height: var(--rezeta-logo-height, 50px);
    width: auto;
    max-width: 100%;
}

.rezeta-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
}

/* Mobile Constraints */
@media (max-width: 991px) {
    .rezeta-header-logo {
        flex-shrink: 1;
        min-width: 0;
        max-width: 65%;
        /* Reduce to ensure space for icons */
        overflow: hidden;
    }

    .rezeta-header-main {
        gap: 8px;
        /* Tighter gap on mobile */
    }

    .rezeta-header .rezeta-container {
        padding-left: 20px !important;
        padding-right: 20px !important;
        box-sizing: border-box !important;
    }

    .rezeta-header-right {
        gap: 15px !important;
        /* Override inline style from customizer on mobile */
    }
}

/* White Logo Filter (CSS) */
.rezeta-logo--white img {
    filter: brightness(0) invert(1);
}

.rezeta-logo--white.rezeta-logo-text {
    color: #ffffff;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.rezeta-main-navigation {
    flex-grow: 1;
}

.rezeta-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.rezeta-menu li {
    position: relative;
}

.rezeta-menu a {
    display: block;
    padding: 10px 15px;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.rezeta-menu a:hover,
.rezeta-menu .current-menu-item>a {
    color: #0073aa;
}

/* Sub-menu */
.rezeta-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    list-style: none;
    margin: 0;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.rezeta-menu li:hover>.sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rezeta-menu .sub-menu a {
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 400;
}

.rezeta-menu .sub-menu .sub-menu {
    top: 0;
    left: 100%;
}

/* ==========================================================================
   Menu Toggle (Mobile)
   ========================================================================== */
.rezeta-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
}

.rezeta-menu-toggle-icon,
.rezeta-menu-toggle-icon::before,
.rezeta-menu-toggle-icon::after {
    display: block;
    width: 20px;
    height: 2px;
    background-color: currentColor;
    position: absolute;
    left: 10px;
    transition: all 0.3s ease;
}

.rezeta-menu-toggle-icon {
    top: 50%;
    transform: translateY(-50%);
}

.rezeta-menu-toggle-icon::before {
    content: '';
    top: -6px;
}

.rezeta-menu-toggle-icon::after {
    content: '';
    top: 6px;
}

/* Active state */
.rezeta-menu-toggle[aria-expanded="true"] .rezeta-menu-toggle-icon {
    background-color: transparent;
}

.rezeta-menu-toggle[aria-expanded="true"] .rezeta-menu-toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.rezeta-menu-toggle[aria-expanded="true"] .rezeta-menu-toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

/* ==========================================================================
   Header Extra (Search + Social)
   ========================================================================== */
.rezeta-header-extra {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* ==========================================================================
   Search
   ========================================================================== */
.rezeta-header-search {
    position: relative;
}

.rezeta-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    transition: color 0.3s ease;
}

.rezeta-search-toggle:hover {
    color: #0073aa;
}

.rezeta-search-form-wrapper {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    padding: 15px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.rezeta-header-search.active .rezeta-search-form-wrapper {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rezeta-search-form-wrapper .search-form {
    display: flex;
}

.rezeta-search-form-wrapper .search-field {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.rezeta-search-form-wrapper .search-submit {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.rezeta-search-form-wrapper .search-submit:hover {
    background: #005177;
}

/* ==========================================================================
   Social Icons
   ========================================================================== */
.rezeta-social-icons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rezeta-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: inherit;
    border-radius: 50%;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.rezeta-social-icon:hover {
    color: #0073aa;
    background-color: rgba(0, 115, 170, 0.1);
}

.rezeta-social-icons--header .rezeta-social-icon {
    width: 32px;
    height: 32px;
}

/* ==========================================================================
   Header HTML
   ========================================================================== */
.rezeta-header-html {
    padding: 10px 0;
}

.rezeta-header-html--before {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
}

.rezeta-header-html--after {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: 10px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 991px) {
    .rezeta-header-main {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
    }

    .rezeta-header-logo {
        flex-shrink: 0;
    }

    /* Group: extras + toggle on the right */
    .rezeta-main-navigation {
        position: static;
        flex-grow: 0;
        flex-shrink: 0;
    }

    .rezeta-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .rezeta-header .rezeta-container {
        position: relative;
    }

    .rezeta-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 20px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .rezeta-menu.active {
        display: flex;
    }

    .rezeta-menu a {
        padding: 12px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .rezeta-menu .sub-menu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding-left: 20px;
    }

    .rezeta-search-form-wrapper {
        width: 250px;
        right: 0;
    }
}

@media (max-width: 575px) {
    .rezeta-header-main {
        gap: 8px;
    }

    .rezeta-header-extra {
        gap: 3px !important;
    }

    .rezeta-social-icons--header {
        display: none;
    }

    .rezeta-search-toggle {
        width: 32px;
        height: 32px;
    }

    .rezeta-menu-toggle {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .rezeta-search-form-wrapper {
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        width: auto;
    }
}