/**
 * Responsive Two-Column Layout
 * Top Navigation + Left Sidebar + Main Content
 * Clean, modern design with balanced ad support
 */

:root {
    --navbar-height: 64px;
    --sidebar-width: 250px;
    --content-max-width: 1000px;
    --spacing: 1.5rem;
    --transition: all 0.3s ease;
}

/* ============================================
   TOP NAVIGATION BAR
   ============================================ */

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--color-white, #ffffff);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing);
    gap: 2rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar-brand a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-primary, #0F172A);
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-brand i {
    color: var(--color-accent, #3B82F6);
    font-size: 1.5rem;
}

/* Main Navigation Menu */
.navbar-menu {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--color-text, #475569);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background: var(--color-bg-hover, #f1f5f9);
    color: var(--color-primary, #0F172A);
}

.nav-item.active .nav-link {
    background: var(--color-accent-light, #EFF6FF);
    color: var(--color-accent, #3B82F6);
}

/* Dropdown */
.dropdown-toggle {
    gap: 0.5rem;
}

.dropdown-toggle i {
    font-size: 0.625rem;
    transition: transform 0.2s;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--color-white, #ffffff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    margin-top: 0.5rem;
    display: none;
    z-index: 100;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--color-text, #475569);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--color-bg-hover, #f1f5f9);
}

/* Navbar Right */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-search {
    display: flex;
    align-items: center;
    background: var(--color-bg-light, #f8fafc);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    gap: 0.5rem;
}

.navbar-search input {
    border: none;
    background: none;
    outline: none;
    width: 200px;
    font-size: 0.875rem;
}

.navbar-search button {
    border: none;
    background: none;
    color: var(--color-text-muted, #6b7280);
    cursor: pointer;
}

.theme-toggle,
.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    color: var(--color-text, #475569);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
}

.theme-toggle:hover,
.nav-icon:hover {
    background: var(--color-bg-hover, #f1f5f9);
    color: var(--color-primary, #0F172A);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text, #475569);
    margin: 3px 0;
    transition: var(--transition);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   HEADER AD
   ============================================ */

.header-ad-wrapper {
    position: relative;
    background: var(--color-bg-light, #fafafa);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    padding: 15px 0;
    text-align: center;
    margin-top: var(--navbar-height);
}

.ad-close {
    position: absolute;
    top: 10px;
    right: 20px;
    background: var(--color-white, #ffffff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--color-text-muted, #6b7280);
    transition: var(--transition);
}

.ad-close:hover {
    background: var(--color-bg-hover, #f1f5f9);
}

.ad-label {
    font-size: 11px;
    color: var(--color-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */

.page-wrapper {
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    display: block; /* Changed from flex to block since sidebar is fixed */
    position: relative;
}

/* ============================================
   LEFT SIDEBAR
   ============================================ */

.left-sidebar {
    position: fixed;
    left: 0;
    top: var(--navbar-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--color-white, #ffffff);
    border-right: 1px solid var(--color-border, #e5e7eb);
    overflow-y: auto;
    z-index: 900;
    transition: transform 0.3s ease;
}

.sidebar-content {
    padding: var(--spacing);
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted, #6b7280);
    cursor: pointer;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    color: var(--color-text, #475569);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: var(--transition);
    font-size: 0.9375rem;
}

.sidebar-link:hover {
    background: var(--color-bg-hover, #f1f5f9);
    color: var(--color-primary, #0F172A);
}

.sidebar-link.active {
    background: var(--color-accent-light, #EFF6FF);
    color: var(--color-accent, #3B82F6);
    font-weight: 500;
}

.sidebar-link i {
    width: 20px;
    font-size: 0.875rem;
}

.sidebar-link .badge {
    background: var(--color-bg-muted, #f1f5f9);
    color: var(--color-text-muted, #6b7280);
    padding: 0.125rem 0.375rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
}

/* Progress Widget */
.progress-widget {
    background: var(--color-bg-light, #f8fafc);
    border-radius: 0.5rem;
    padding: 1rem;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.progress-bar {
    height: 8px;
    background: var(--color-border, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent, #3B82F6), #10B981);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.btn-link {
    color: var(--color-accent, #3B82F6);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Sidebar Ad */
.sidebar-ad {
    margin: 2rem 0;
    padding: 1rem;
    background: var(--color-bg-light, #f8fafc);
    border-radius: 0.5rem;
}

/* Newsletter Box */
.newsletter-box {
    background: var(--color-bg-light, #f8fafc);
    border-radius: 0.5rem;
    padding: 1rem;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.newsletter-form input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.newsletter-form button {
    padding: 0.5rem 1rem;
    background: var(--color-accent, #3B82F6);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background: var(--color-accent-dark, #2563EB);
}

/* Sidebar Toggle (Mobile) */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 1rem;
    width: 56px;
    height: 56px;
    background: var(--color-accent, #3B82F6);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 800;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--color-accent-dark, #2563EB);
    transform: scale(1.05);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 850;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    padding-left: 40px; /* Extra padding to ensure content doesn't touch sidebar */
    padding-right: 20px;
    padding-top: 0;
    padding-bottom: 0;
    min-height: calc(100vh - var(--navbar-height));
    background: transparent;
    transition: margin-left 0.3s ease;
}

.content-wrapper {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 2rem;
}

/* In-Content Ads */
.in-content-ad {
    margin: 3rem 0;
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--color-border, #e5e7eb);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.ad-unit {
    display: inline-block;
    margin: 0 auto;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet (768px - 1199px) */
@media (max-width: 1199px) {
    .left-sidebar {
        transform: translateX(-100%);
    }

    .left-sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    }

    .main-content {
        margin-left: 0;
        padding-left: 20px; /* Normal padding on mobile */
        padding-right: 20px;
    }

    .content-wrapper {
        max-width: 800px;
        margin: 0 auto;
    }

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

    .sidebar-close {
        display: block;
    }
}

/* Mobile (<768px) */
@media (max-width: 767px) {
    /* Top Navbar Mobile */
    .navbar-container {
        padding: 0 1rem;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .navbar-menu {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        background: var(--color-white, #ffffff);
        border-bottom: 1px solid var(--color-border, #e5e7eb);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        padding: 1rem;
        display: none;
    }

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

    .navbar-nav {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: var(--color-bg-light, #f8fafc);
        margin-top: 0;
    }

    .navbar-right {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--color-border, #e5e7eb);
    }

    .navbar-search {
        width: 100%;
    }

    .navbar-search input {
        width: 100%;
    }

    /* Content */
    .content-wrapper {
        padding: 1rem;
    }

    /* Hide/Show Elements */
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* Ads */
    .header-ad-wrapper {
        padding: 10px 0;
    }

    .in-content-ad {
        margin: 2rem 0;
        padding: 1rem 0;
    }
}

/* ============================================
   DARK MODE
   ============================================ */

[data-theme="dark"] .top-navbar {
    background: var(--color-dark-bg, #1e293b);
    border-bottom-color: var(--color-dark-border, #334155);
}

[data-theme="dark"] .left-sidebar {
    background: var(--color-dark-bg, #1e293b);
    border-right-color: var(--color-dark-border, #334155);
}

[data-theme="dark"] .dropdown-menu {
    background: var(--color-dark-card, #0f172a);
    border-color: var(--color-dark-border, #334155);
}

[data-theme="dark"] .sidebar-link:hover,
[data-theme="dark"] .nav-link:hover {
    background: var(--color-dark-hover, #334155);
}

[data-theme="dark"] .header-ad-wrapper {
    background: var(--color-dark-bg, #1e293b);
    border-bottom-color: var(--color-dark-border, #334155);
}

/* ============================================
   UTILITIES
   ============================================ */

.mobile-only {
    display: none;
}

/* Custom scrollbar */
.left-sidebar::-webkit-scrollbar {
    width: 6px;
}

.left-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.left-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border, #e5e7eb);
    border-radius: 3px;
}

.left-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted, #9ca3af);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

body.menu-open,
body.sidebar-open {
    overflow: hidden;
}