/**
 * Layout Styles
 * 
 * @package SIC_Base_Theme
 */

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* Content Area */
.content-area {
    display: flex;
    gap: var(--gap);
    margin: var(--spacing-xl) 0;
}

.content-area.full-width .site-main {
    width: 100%;
}

.content-area.has-sidebar {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--gap);
}

/* Main Content */
.site-main {
    flex: 1;
}

/* Sidebar */
.sidebar {
    flex-shrink: 0;
}

/* Header */
.site-header {
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1002;
}

.header-top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    position: relative;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.site-branding img {
    height: auto;
    width: auto;
    max-width: 100%;
}

.header-right-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-left: auto;
}

/* Navigation */
.main-navigation {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1001;
}

.main-navigation a,
.main-navigation a:link,
.main-navigation a:visited {
    color: #ffffff;
    text-decoration: none;
}

.main-navigation a:hover,
.main-navigation a:active {
    color: #ffffff;
    text-decoration: none;
    opacity: 0.8;
}

.menu-toggle {
    display: none;
    background: var(--hamburger-bg-color, rgba(255, 255, 255, 0.9));
    border: 2px solid var(--hamburger-border-color, #333);
    border-radius: 4px;
    cursor: pointer;
    padding: 10px;
    width: 50px;
    height: 50px;
    position: relative;
    z-index: 1003;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: var(--hamburger-bg-color, rgba(255, 255, 255, 1));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.menu-toggle-icon {
    display: block;
    position: relative;
    width: 30px;
    height: 3px;
    background-color: var(--hamburger-icon-color, #333);
    transition: all 0.3s ease;
    margin: auto;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 30px;
    height: 3px;
    background-color: var(--hamburger-icon-color, #333);
    transition: all 0.3s ease;
}

.menu-toggle-icon::before {
    top: -10px;
}

.menu-toggle-icon::after {
    bottom: -10px;
}

/* Hamburger animatie naar X */
.menu-toggle.active .menu-toggle-icon {
    background-color: transparent;
}

.menu-toggle.active .menu-toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.menu-toggle.active .menu-toggle-icon::after {
    bottom: 0;
    transform: rotate(-45deg);
}

.primary-menu-container ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--spacing-lg);
}

.primary-menu-container a {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text);
    font-weight: 500;
}

.primary-menu-container a:hover {
    color: var(--color-primary);
}

/* Footer */
.site-footer {
    background: var(--color-background-alt);
    margin-top: var(--spacing-xxxl);
}

.footer-widgets {
    padding: var(--spacing-xxl) 0;
    border-bottom: 1px solid var(--color-border);
}

.footer-widgets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
}

.footer-bottom {
    padding: var(--spacing-lg) 0;
}

.footer-bottom-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-area.has-sidebar {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: 2;
    }
    
    /* Header layout voor tablet */
    .header-top-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .site-branding {
        order: 1;
        flex: 0 1 auto;
    }
    
    .site-branding img {
        max-height: 80px;
    }
    
    .header-right-section {
        order: 2;
        display: flex;
        align-items: center;
        gap: 15px;
        margin-left: auto;
    }
    
    /* Show hamburger menu on tablet and mobile */
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        order: 2;
    }
    
    /* Ensure navigation is visible */
    .main-navigation {
        display: flex !important;
        order: 2;
    }
    
    .header-search {
        order: 1;
    }
    
    .primary-menu-container {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--color-background);
        z-index: 1000;
        overflow-y: auto;
        padding-top: 100px;
        animation: slideIn 0.3s ease;
    }
    
    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .primary-menu-container.active {
        display: block !important;
    }
    
    .primary-menu-container ul {
        flex-direction: column;
        gap: 0;
        padding: var(--spacing-lg);
    }
    
    .primary-menu-container > ul > li {
        border-bottom: 1px solid var(--color-border);
    }
    
    .primary-menu-container a {
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 1.1rem;
    }
    
    /* Submenu styling voor mobiel/tablet */
    .primary-menu-container .sub-menu {
        display: none;
        padding-left: var(--spacing-lg);
        background: var(--color-background-alt);
    }
    
    .primary-menu-container .menu-item-has-children.open > .sub-menu {
        display: block;
    }
    
    .primary-menu-container .menu-item-has-children > a::after {
        content: '\25BC';
        float: right;
        transition: transform 0.3s ease;
        font-size: 0.8em;
    }
    
    .primary-menu-container .menu-item-has-children.open > a::after {
        transform: rotate(180deg);
    }
}

@media (max-width: 768px) {
    .footer-widgets-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom-inner {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .primary-menu-container {
        padding-top: 80px;
    }
    
    .site-branding img {
        max-height: 60px;
    }
    
    .header-top-inner {
        padding: 12px 0;
    }
    
    /* Zoekbalk blijft zichtbaar maar kleiner */
    .header-search {
        max-width: 120px;
    }
    
    .header-search .search-field {
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .header-search .search-submit {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    /* Extra kleine schermen */
    .site-branding img {
        max-height: 50px;
    }
    
    .header-top-inner {
        padding: 8px 0;
    }
    
    .menu-toggle {
        width: 45px;
        height: 45px;
        padding: 8px;
    }
    
    .menu-toggle-icon {
        width: 25px;
    }
    
    .menu-toggle-icon::before,
    .menu-toggle-icon::after {
        width: 25px;
    }
    
    /* Nog kleinere zoekbalk */
    .header-search {
        max-width: 100px;
    }
    
    .header-search .search-field {
        font-size: 11px;
        padding: 5px 6px;
    }
    
    .header-search .search-submit {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .header-right-section {
        gap: 8px;
    }
}
