/* --- CSS VARIABLES --- */

:root {
    /* Light Mode (Classic) */
    --primary-color: #0056b3;
    --secondary-color: #f0f4f8;
    --accent-color: #e67e22;
    --text-color: #333;
    --text-light: #555;
    --white: #ffffff;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --header-bg: var(--white);
    --header-text: #333;
    --card-bg: var(--white);
    --border-color: #ddd;
    --nav-active: #eef5ff;
}

body.dark-mode {
    /* Dark Mode (Classic Dark) */
    --secondary-color: #121212;
    --white: #1e1e1e;
    --text-color: #e0e0e0;
    --text-light: #b0b0b0;
    --header-bg: #1e1e1e;
    --header-text: #fff;
    --card-bg: #252526;
    --border-color: #3e3e42;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    --nav-active: #2c2c2c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--secondary-color);
    transition: background 0.3s, color 0.3s;
}

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

ul {
    list-style: none;
}


/* --- HEADER & NAV --- */

header {
    background-color: var(--header-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 10px;
    /* Reduced gap for tighter menu */
    align-items: center;
}


/* Nav Links Styling */

.nav-links a,
.nav-links .dropbtn {
    font-weight: 500;
    transition: color 0.3s, background 0.3s;
    color: var(--header-text);
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    cursor: pointer;
}

.nav-links a:hover,
.nav-links .dropbtn:hover,
.nav-links a.active {
    color: var(--primary-color);
    background-color: var(--nav-active);
}


/* Code Online Button Styling */

.btn-nav-code {
    background-color: var(--primary-color);
    color: var(--white) !important;
    padding: 0.6rem 1.2rem !important;
    font-weight: bold;
    transition: transform 0.2s;
}

.btn-nav-code:hover {
    transform: translateY(-2px);
    background-color: #004494 !important;
}


/* --- DROPDOWN MENU SOLUTION --- */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: none;
    border: none;
    font-family: inherit;
    color: var(--header-text);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    /* Aligns dropdown to the right edge of the button */
    background-color: var(--card-bg);
    min-width: 200px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    z-index: 1;
    padding: 0.5rem 0;
    margin-top: 5px;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 0.8rem 1rem;
    text-decoration: none;
    display: block;
    text-align: left;
    border-radius: 0;
}

.dropdown-content a:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.dropdown:hover .dropdown-content {
    display: block;
    /* Show dropdown on hover */
}


/* --- THEME TOGGLE --- */

.btn-icon {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--header-text);
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    margin-left: 10px;
}

body.dark-mode .btn-icon {
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(15deg);
}


/* --- MAIN LAYOUT --- */

.main-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2rem;
    min-height: 80vh;
}

.content-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-size: 2rem;
}

h2 {
    color: var(--text-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

h3 {
    color: var(--text-light);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

p {
    margin-bottom: 1.2rem;
    color: var(--text-light);
    text-align: justify;
}

ul.styled-list {
    list-style-type: disc;
    margin-left: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

ul.styled-list li {
    margin-bottom: 0.5rem;
}


/* --- CONTACT FORM --- */

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

input,
textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-color);
    color: var(--text-color);
    border-radius: var(--border-radius);
    font-family: inherit;
}

input:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    border-color: transparent;
}

.btn-submit {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.8rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: 0.3s;
}

.btn-submit:hover {
    background-color: #004494;
}


/* --- SIDEBAR ADS --- */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.ad-placeholder {
    background-color: #e9ecef;
    border: 2px dashed #ced4da;
    color: #6c757d;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: var(--border-radius);
    transition: background 0.3s;
}

body.dark-mode .ad-placeholder {
    background-color: #252526;
    border-color: #3e3e42;
    color: #888;
}

.ad-vertical {
    width: 100%;
    height: 600px;
    position: sticky;
    top: 100px;
}

.ad-square {
    width: 100%;
    height: 250px;
}


/* --- FOOTER --- */

footer {
    background-color: #1a1a1a;
    color: #ccc;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}


/* --- RESPONSIVE --- */

@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .ad-vertical {
        display: none;
    }
    .nav-links {
        gap: 5px;
    }
    .nav-links a,
    .nav-links .dropbtn {
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    .dropdown-content {
        position: static;
        /* On mobile, just show it normally or stack */
        box-shadow: none;
        border: none;
        background: var(--secondary-color);
        display: none;
        /* JS or CSS logic needed for mobile tap */
    }
    /* Show dropdown on hover for desktop, but for mobile simplicity in this CSS-only approach:
       We rely on hover or tap expanding the parent */
    .dropdown:hover .dropdown-content {
        display: block;
        width: 100%;
        text-align: center;
    }
}