/* CSS Variables with Fallbacks */
:root {
    --primary-color: #444;
    --secondary-color: #e7e7e7;
    --background-color: #f4f4f4;
    --text-color: #333;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --hover-color: color-mix(in srgb, var(--primary-color) 80%, white 20%);
}

body {
    font-family: 'CustomFont', Arial, sans-serif;
    background-color: var(--background-color, #f4f4f4);
    color: var(--text-color, #333);
    line-height: 1.6;
    padding: 2rem;
}

.container {
    max-width: 80vw; 
    margin: auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--card-shadow);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}
.container:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

h1, h2 {
    color: var(--primary-color, #444);
    text-align: center;
}
h1 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
}
h2 {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

ul {
    list-style-type: none;
    padding: 0;
}
ul li {
    background: var(--secondary-color);
    margin: 0.5rem 0;
    padding: 1rem;
    border-radius: 4px;
    transition: background 0.3s ease-in-out;
}
ul li:hover {
    background: var(--hover-color);
}

#homepage {
    text-align: center;
    width: 100px;
    height: 40px; 
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid black; 
    background-color: lightgray; 
    margin: auto; 
    padding: 5px; 
    border-radius: 5px; 
}

#homepage a {
    text-decoration: none;
    color: black; 
    font-weight: bold; 
}

#homepage:hover {
    background-color: darkgray; 
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 3rem;
    }
    .container {
        max-width: 90dvw;
        padding: 1.5rem;
    }
    h1 {
        font-size: 1.9rem;
    }
    h2 {
        font-size: 1.6rem;
    }
}

/* Small Screens */
@media (max-width: 480px) {
    body {
        padding: 5dvw;
    }
    .container {
        max-width: 90dvw;
        padding: 1.5rem;
    }
    h1 {
        font-size: 1.8rem;
    }
    h2 {
        font-size: 1.5rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 0.5s ease-in-out;
}

/* New CSS Selectors */
.container:has(h1) {
    border: 2px solid var(--primary-color);
}

/* Dark Mode */
/* Default Light Mode */
:root {
    --bg-color: white;
    --text-color: black;
    --header-color: #007BFF;
    --link-color: #007BFF;
    --font-family: Arial, sans-serif;
}


[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --header-color: #1E90FF;
    --link-color: #1E90FF;
    --font-family: Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s, font-family 0.3s;
}

.container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

h1, h2 {
    color: var(--header-color);
}

ul {
    list-style-type: none;
    padding: 0;
}

ul li {
    margin: 10px 0;
}

#theme-toggle {
    color: #007BFF;
    position: fixed;
    top: 10px;
    right: 10px;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    z-index: 1001; /* Ensure it stays above the customizer */
}

#theme-customizer {
    position: fixed;
    top: 60px; /* Adjust to avoid overlapping with the theme toggle */
    right: 10px;
    background: var(--bg-color);
    padding: 10px;
    border: 1px solid var(--text-color);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000; /* Ensure it stays on top of other elements */
    max-width: 250px; /* Limit the width */
}

#theme-customizer label {
    display: block;
    margin-bottom: 5px;
}

#theme-customizer input, #theme-customizer select {
    margin-bottom: 10px;
    width: 100%; /* Make inputs and selects fill the container */
}

#save-theme, #reset-theme {
    background-color: var(--header-color);
    color: white;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%; /* Make buttons fill the container */
    margin-top: 10px;
}

#reset-theme {
    background-color: #ff4444;
}

#reset-theme:hover {
    background-color: #cc0000;
}

#homepage {
    text-align: center;
    margin-top: 20px;
}

#homepage a {
    color: var(--link-color);
    text-decoration: none;
}

#homepage a:hover {
    text-decoration: underline;
}