/* Basic Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ----------------------------------
   Top Navigation Bar
   ---------------------------------- */
.top-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #282A35; /* Dark blue/grey like W3Schools */
    color: #fff;
    padding: 8px 20px;
    font-size: 15px;
    height: 60px; /* Fixed height for consistency */
    position: sticky; /* Stays at the top when scrolling */
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.top-nav-logo {
    font-weight: bold;
    font-size: 1.2em;
    padding-right: 20px;
    color: #04AA6D; /* Green accent */
}

.top-nav-links {
    display: flex;
    flex-grow: 1;
    margin-right: 20px;
    overflow-x: auto; /* Allow horizontal scroll on smaller screens */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    white-space: nowrap; /* Prevent wrapping */
}

.top-nav-links a {
    padding: 8px 12px;
    margin-right: 5px;
    transition: background-color 0.3s;
    border-radius: 3px;
    font-size: 0.9em;
}

.top-nav-links a:hover {
    background-color: #04AA6D;
}

.top-nav-actions {
    display: flex;
    align-items: center;
}

.top-nav-btn {
    background-color: transparent;
    border: none;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.1em;
    margin-left: 5px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

.top-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.green-btn {
    background-color: #04AA6D;
}
.green-btn:hover {
    background-color: #059862;
}

.yellow-btn {
    background-color: #FFC0CB; /* Pink from W3S */
    color: #282A35;
}
.yellow-btn:hover {
    background-color: #e6b0bc;
}

/* ----------------------------------
   Main Container (Sidebar + Content)
   ---------------------------------- */
.container {
    display: flex;
    max-width: 1600px; /* Max width like W3Schools */
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

/* ----------------------------------
   Left Sidebar Navigation
   ---------------------------------- */
.sidebar {
    width: 280px; /* Adjusted width */
    flex-shrink: 0; /* Prevent shrinking */
    background-color: #E7E9EB; /* Light grey from W3Schools */
    padding-top: 20px;
    padding-left: 0; /* Links have internal padding */
    padding-right: 0;
    border-right: 1px solid #ddd;
    overflow-y: auto; /* Enable scrolling if content overflows */
    height: calc(100vh - 60px); /* Adjust height to fit below top nav */
    position: sticky; /* Make it sticky */
    top: 60px; /* Stick below the top nav */
}

.sidebar h2 {
    font-size: 24px;
    padding: 10px 16px;
    color: #555;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
}

.sidebar-nav li a {
    display: block;
    padding: 8px 16px;
    color: #555;
    font-size: 17px;
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav li a:hover:not(.active) {
    background-color: #ddd;
    color: #000;
}

.sidebar-nav li.active a {
    background-color: #04AA6D; /* Highlight color */
    color: white;
}

/* ----------------------------------
   Main Content Area
   ---------------------------------- */
.content {
    flex-grow: 1; /* Take remaining space */
    padding: 20px 30px;
    max-width: calc(100% - 280px); /* Ensure content doesn't overflow */
}

.ad-banner {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
    margin-bottom: 25px;
    font-style: italic;
    color: #666;
    height: 100px; /* Roughly match the ad height in image */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.ad-banner img {
    max-width: 100%;
    height: auto;
    margin-top: 5px;
}


.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.content-header h1 {
    font-size: 2.2em;
    color: #333;
}

.nav-buttons a {
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    color: white;
    transition: background-color 0.3s;
}

.prev-btn {
    background-color: #04AA6D;
    margin-right: 10px;
}
.prev-btn:hover {
    background-color: #059862;
}

.next-btn {
    background-color: #04AA6D;
}
.next-btn:hover {
    background-color: #059862;
}

hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

h2 {
    font-size: 1.8em;
    color: #333;
    margin-top: 30px;
    margin-bottom: 15px;
}

p {
    margin-bottom: 1em;
    font-size: 16px;
    color: #333;
}

.code-block {
    background-color: #f0f0f0;
    border-left: 4px solid #04AA6D;
    padding: 15px 20px;
    margin: 20px 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.1em;
    white-space: pre-wrap; /* Allows text to wrap */
    word-wrap: break-word; /* Breaks long words */
    color: #333;
}

.code-block .prompt {
    color: #888; /* Slightly grey out the prompt part */
    user-select: none; /* Prevent selection of the prompt */
}

/* ----------------------------------
   Responsive Adjustments (for smaller screens)
   ---------------------------------- */
@media (max-width: 1200px) {
    .top-nav-links {
        display: none; /* Hide extensive links on smaller desktop/tablet */
    }
}

@media (max-width: 900px) {
    .sidebar {
        width: 200px; /* Make sidebar a bit narrower */
    }
    .content {
        max-width: calc(100% - 200px);
    }
    .top-nav-actions .yellow-btn {
        display: none; /* Hide "Get Certified" on smaller screens */
    }
}

@media (max-width: 768px) {
    .top-navbar {
        flex-wrap: wrap; /* Allow items to wrap */
        justify-content: center;
        height: auto;
        padding: 10px 15px;
    }
    .top-nav-logo {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
        padding-right: 0;
    }
    .top-nav-actions {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    .top-nav-actions .green-btn,
    .top-nav-actions .yellow-btn {
        margin: 0 5px;
    }

    .container {
        flex-direction: column; /* Stack sidebar and content */
    }

    .sidebar {
        width: 100%; /* Full width for sidebar */
        height: auto; /* Auto height */
        position: static; /* No longer sticky */
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    .sidebar h2 {
        border-bottom: none;
        text-align: center;
        font-size: 20px;
    }
    .sidebar-nav {
        /* You might want to make this collapsible with JS on mobile */
        max-height: 200px; /* Example: Limit height and make it scrollable */
        overflow-y: auto;
        border-top: 1px solid #eee;
        margin-top: 10px;
    }
    .sidebar-nav li a {
        font-size: 15px;
    }


    .content {
        padding: 15px;
        max-width: 100%; /* Full width */
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-buttons {
        width: 100%;
        display: flex;
        justify-content: space-between;
        margin-top: 15px;
    }
    .nav-buttons a {
        flex-grow: 1;
        text-align: center;
        padding: 8px 10px;
        font-size: 0.9em;
    }
    .prev-btn {
        margin-right: 5px;
    }
    .next-btn {
        margin-left: 5px;
    }
    
    .ad-banner {
        height: auto; /* Allow ad banner to adjust height */
        padding: 15px 10px;
    }
}

@media (max-width: 480px) {
    .top-nav-actions .top-nav-btn {
        font-size: 1em; /* Smaller icons on very small screens */
        padding: 6px 10px;
    }
    .top-nav-actions .green-btn,
    .top-nav-actions .yellow-btn {
        font-size: 0.8em;
    }
    h1 {
        font-size: 1.8em;
    }
    h2 {
        font-size: 1.5em;
    }
    p {
        font-size: 15px;
    }
    .code-block {
        font-size: 0.95em;
        padding: 12px 15px;
    }
    .sidebar-nav {
        max-height: 150px; /* Even smaller for very small phones */
    }
}