/* --- CSS Variables --- */
:root {
    /* HEADER (Light by default) */
    --header-bg: #ffffff;
    --header-text: #333333;
    --header-shadow: 0 2px 10px rgba(0,0,0,0.05);
    
    /* SIDEBAR (Light by default) */
    --sidebar-bg: #ffffff;
    --sidebar-text: #333333;
    --sidebar-border: #e2e8f0; 
    --icon-bg: #f1f5f9;
    
    --accent-color: #6366f1; 
}

/* DARK MODE OVERRIDES */
body.dark-mode {
    --header-bg: #0f172a;
    --header-text: #f8fafc;
    --header-shadow: 0 2px 10px rgba(0,0,0,0.3);
    
    --sidebar-bg: #0f172a;
    --sidebar-text: #f8fafc;
    --sidebar-border: rgba(255,255,255,0.1); 
    --icon-bg: rgba(255,255,255,0.05);

    background: #1e293b !important;
    color: #e2e8f0 !important;
}
body.dark-mode .container {
    background: #1e293b;
    box-shadow: none;
    border: 1px solid #334155;
}

/* --- Main Header Container --- */
.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    box-shadow: var(--header-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.5rem 0.5rem;
    height: 50px;
    display: flex;
    align-items: center;
    transition: background 0.3s, color 0.3s;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 15px;
}

/* --- Branding --- */
.header-branding .site-title a {
    font-weight: 800;
    font-size: 1.3rem;
    background: linear-gradient(to right, #f99a5e 0%, #f65c69 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    text-transform: uppercase;
    line-height: 1;
}
.header-branding .custom-logo {
    max-height: 32px;
    width: auto;
}

/* --- Desktop Navigation --- */
.header-desktop-nav ul {
    display: flex;
    gap: 25px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.header-desktop-nav a {
    text-decoration: none;
    color: var(--header-text);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.header-desktop-nav a:hover {
    color: var(--accent-color);
}

/* --- Tools --- */
.header-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--header-text);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1002; 
}
.icon-btn svg { 
    width: 20px; 
    height: 20px; 
    pointer-events: none; 
}
.icon-btn:hover { background: rgba(125,125,125,0.1); }

/* --- Mobile Sidebar --- */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 2000;
    transform: translateX(-100%);
    visibility: hidden; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s, background 0.3s;
    padding: 20px 15px; 
    box-shadow: 2px 0 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
}

.mobile-sidebar.active {
    transform: translateX(0);
    visibility: visible;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    border-bottom: 1px solid var(--sidebar-border);
    padding-bottom: 15px;
    flex-shrink: 0;
}

/* Sidebar Branding Styles */
.sidebar-branding .custom-logo {
    max-height: 28px;
    width: auto;
}
.sidebar-site-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sidebar-text);
    margin: 0;
    text-transform: capitalize;
}

#menu-close {
    background: var(--icon-bg);
    color: var(--sidebar-text);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    padding: 0;
}
#menu-close:hover { opacity: 0.8; }

/* Menu List */
.sidebar-menu-list, 
.sidebar-menu-list li { 
    list-style: none !important; 
    list-style-type: none !important;
    padding: 0; 
    margin: 0; 
}

.sidebar-menu-list {
    flex-grow: 1;
    margin-left: -15px;
}

.sidebar-menu-list li a {
    display: flex;
    align-items: center;
    padding: 12px 0; 
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--sidebar-border);
    
    margin-left: -25px;
    
    /* UPDATED PADDING LEFT */
    padding-left: 5px;
}

/* The Square Icon */
.sidebar-menu-list li a::before {
    content: '';
    display: inline-block;
    width: 6px; 
    height: 6px;
    background-color: currentColor;
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar-menu-list li a:hover { 
    color: var(--accent-color);
    padding-left: 30px; 
    transition: padding 0.2s; 
}

/* Socials */
.sidebar-socials {
    margin-top: 50px;
    padding-top: 0;
    padding-bottom: 40px;
    border-top: 1px solid var(--sidebar-border);
    width: 100%; 
    box-sizing: border-box;
    flex-shrink: 0;
}
.socials-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sidebar-text);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    text-align: left;
    padding-left: 0;
}
.social-icons-list {
    display: flex;
    align-items: center;
    justify-content: flex-start; 
    gap: 12px;
    padding-left: 0;
    flex-wrap: wrap; 
}
.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text);
    opacity: 0.8;
    width: 36px;
    height: 36px;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0; 
}
.social-icon svg { width: 20px; height: 20px; }
.social-icon:hover { 
    color: #fff; 
    border-color: var(--accent-color); 
    background: var(--accent-color); 
    opacity: 1;
}

/* Overlays */
.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0; visibility: hidden; transition: opacity 0.3s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.search-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.98);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.2s;
}
.search-overlay.active { opacity: 1; visibility: visible; }
.search-overlay input {
    width: 90%; max-width: 600px;
    background: transparent; border: none; border-bottom: 2px solid #fff;
    color: #fff; font-size: 2rem; padding: 10px; outline: none;
}
.close-search {
    position: absolute; top: 20px; right: 20px;
    background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer;
}

/* =========================================
   RESPONSIVE LAYOUT
   ========================================= */

@media (min-width: 769px) {
    .header-mobile-trigger { display: none; }
    .header-branding { margin-right: 0; }
    
    .header-desktop-nav {
        display: block; 
        margin-left: auto;
        margin-right: 40px; 
    }
}

@media (max-width: 768px) {
    .header-desktop-nav { display: none; }
    
    .header-inner {
        display: grid;
        grid-template-columns: 40px 1fr 40px;
        align-items: center;
    }
    .header-branding {
        text-align: center;
        justify-self: center;
    }
    .header-tools {
        justify-self: end;
        width: auto;
        gap: 5px;
    }
    .header-inner {
         grid-template-columns: auto 1fr auto;
    }
}