/* Header & Footer per Gutenberg - Frontend Styles */

/* Reset and base styles for custom headers and footers */
.hfg-custom-header,
.hfg-custom-footer {
    box-sizing: border-box;
    line-height: 1.6;
}

.hfg-custom-header *,
.hfg-custom-footer * {
    box-sizing: border-box;
}

/* Header specific styles */
.hfg-custom-header {
    position: relative;
    z-index: 999;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Footer specific styles */
.hfg-custom-footer {
    position: relative;
    z-index: 999;
    width: 100%;
    margin: 0;
    padding: 0;
    clear: both;
}

/* Hide theme headers and footers when custom ones are active */
body.hfg-custom-header-active .site-header,
body.hfg-custom-header-active header:not(.hfg-custom-header),
body.hfg-custom-header-active .header,
body.hfg-custom-header-active #header,
body.hfg-custom-header-active .main-header,
body.hfg-custom-header-active .site-branding {
    display: none !important;
}

body.hfg-custom-footer-active .site-footer,
body.hfg-custom-footer-active footer:not(.hfg-custom-footer),
body.hfg-custom-footer-active .footer,
body.hfg-custom-footer-active #footer,
body.hfg-custom-footer-active .main-footer {
    display: none !important;
}

/* Ensure proper positioning for sticky headers */
.hfg-custom-header.hfg-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

/* Add top padding to body when sticky header is active */
body.hfg-sticky-header-active {
    padding-top: var(--hfg-header-height, 80px);
}

/* Common block styles that might be used in headers/footers */
.hfg-custom-header .wp-block-navigation,
.hfg-custom-footer .wp-block-navigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.hfg-custom-header .wp-block-navigation__container,
.hfg-custom-footer .wp-block-navigation__container {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.hfg-custom-header .wp-block-navigation-item,
.hfg-custom-footer .wp-block-navigation-item {
    position: relative;
}

.hfg-custom-header .wp-block-navigation-item a,
.hfg-custom-footer .wp-block-navigation-item a {
    text-decoration: none;
    padding: 8px 16px;
    display: block;
}

.hfg-custom-header .wp-block-navigation-item a:hover,
.hfg-custom-footer .wp-block-navigation-item a:hover {
    text-decoration: underline;
}

/* Social links block styling */
.hfg-custom-header .wp-block-social-links,
.hfg-custom-footer .wp-block-social-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.hfg-custom-header .wp-social-link,
.hfg-custom-footer .wp-social-link {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.hfg-custom-header .wp-social-link:hover,
.hfg-custom-footer .wp-social-link:hover {
    transform: scale(1.1);
}

/* Search block styling */
.hfg-custom-header .wp-block-search,
.hfg-custom-footer .wp-block-search {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hfg-custom-header .wp-block-search__input,
.hfg-custom-footer .wp-block-search__input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
}

.hfg-custom-header .wp-block-search__button,
.hfg-custom-footer .wp-block-search__button {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
}

.hfg-custom-header .wp-block-search__button:hover,
.hfg-custom-footer .wp-block-search__button:hover {
    background: #005a87;
}

/* Logo and site title styling */
.hfg-custom-header .wp-block-site-logo,
.hfg-custom-footer .wp-block-site-logo {
    display: inline-block;
}

.hfg-custom-header .wp-block-site-logo img,
.hfg-custom-footer .wp-block-site-logo img {
    height: auto;
    max-height: 60px;
    width: auto;
}

.hfg-custom-header .wp-block-site-title,
.hfg-custom-footer .wp-block-site-title {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0;
}

.hfg-custom-header .wp-block-site-title a,
.hfg-custom-footer .wp-block-site-title a {
    text-decoration: none;
    color: inherit;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .hfg-custom-header .wp-block-navigation__container,
    .hfg-custom-footer .wp-block-navigation__container {
        flex-direction: column;
        width: 100%;
    }
    
    .hfg-custom-header .wp-block-navigation-item,
    .hfg-custom-footer .wp-block-navigation-item {
        width: 100%;
        text-align: center;
    }
    
    .hfg-custom-header .wp-block-search,
    .hfg-custom-footer .wp-block-search {
        width: 100%;
        margin-top: 16px;
    }
    
    .hfg-custom-header .wp-block-search__input,
    .hfg-custom-footer .wp-block-search__input {
        flex: 1;
    }
}

/* Utility classes for common layouts */
.hfg-flex {
    display: flex;
}

.hfg-flex-wrap {
    flex-wrap: wrap;
}

.hfg-justify-between {
    justify-content: space-between;
}

.hfg-justify-center {
    justify-content: center;
}

.hfg-align-center {
    align-items: center;
}

.hfg-gap-1 {
    gap: 8px;
}

.hfg-gap-2 {
    gap: 16px;
}

.hfg-gap-3 {
    gap: 24px;
}

/* Print styles */
@media print {
    .hfg-custom-header,
    .hfg-custom-footer {
        position: static !important;
        box-shadow: none !important;
    }
}
