:root {
    /* These are special color names we'll use in our styles */
    --bg-primary: #1a233b;
    --bg-secondary: #273045;
    --text-color: #e0e4ef;
    --text-muted: #9ba0af;
    --accent-color: #00c7e2;
    --border-color: #3b455b;
}

body {
    /* We'll use this color for the background of the whole page */
    background-color: #1a233b;
    /* This sets the color of our text */
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* This is for the header at the very top of the page */
header {
    background-color: var(--bg-secondary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid var(--accent-color);
}

header .logo {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin-left: 2rem;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 700;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

nav ul li a:hover, nav ul li a.active {
    color: var(--accent-color);
}

nav ul li a i {
    margin-right: 0.5rem;
}

/* This is the main part of the page */
main {
    flex-grow: 1;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 1024px) {
    main {
        grid-template-columns: 1fr 1fr;
    }
}

.section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

/* These are styles just for the home page */
.home-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    margin-top: 10vh;
}

.home-content h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.home-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--accent-color);
    color: #1a233b;
    text-decoration: none;
    font-weight: 700;
    border-radius: 8px;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
}

.cta-button:hover {
    background-color: #0093a5;
    transform: translateY(-2px);
}

/* These styles are for the Playground and Challenges pages */
.editor-container {
    position: relative;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.editor-header {
    background-color: #3b455b;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-family: 'Inter', monospace;
    border-bottom: 1px solid var(--border-color);
}

.editor-header .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.editor-header .dot.red { background-color: #ff5f56; }
.editor-header .dot.yellow { background-color: #ffbd2e; }
.editor-header .dot.green { background-color: #27c93f; }

#css-editor, #css-editor-challenge {
    flex-grow: 1;
    width: 100%;
    height: 300px;
    padding: 1rem;
    box-sizing: border-box;
    background-color: var(--bg-secondary);
    color: var(--text-color);
    font-family: 'Inter', monospace;
    font-size: 1rem;
    border: none;
    outline: none;
    resize: none;
    line-height: 1.5;
    caret-color: var(--accent-color);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}

#css-editor::-webkit-scrollbar, #css-editor-challenge::-webkit-scrollbar {
    width: 8px;
}

#css-editor::-webkit-scrollbar-thumb, #css-editor-challenge::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

#css-editor::-webkit-scrollbar-track, #css-editor-challenge::-webkit-scrollbar-track {
    background-color: var(--bg-secondary);
}

.preview-container {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.live-preview {
    width: 100%;
    height: 400px;
    border: none;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

/* These are styles just for the Challenges page */
.main-challenges {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .main-challenges {
        grid-template-columns: 250px 1fr;
    }
}

.challenge-sidebar {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

#challenge-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#challenge-list li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
    color: var(--text-muted);
}

#challenge-list li:hover {
    background-color: #3b455b;
    color: var(--text-color);
}

#challenge-list li.active-challenge {
    background-color: var(--accent-color);
    color: #1a233b;
    font-weight: 700;
}

.challenge-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .challenge-content {
        grid-template-columns: 1fr 1fr;
    }
}

.challenge-display h2 {
    font-size: 1.5rem;
    text-align: center;
}

.challenge-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.challenge-buttons .cta-button, .playground-buttons .cta-button {
    flex-grow: 1;
    text-align: center;
    padding: 0.75rem 1.5rem;
}

.solution-button {
    background-color: #555;
    color: white;
}

.solution-button:hover {
    background-color: #777;
    transform: translateY(-2px);
}

.clear-button {
    background-color: #d15656;
    color: white;
}

.clear-button:hover {
    background-color: #b34a4a;
}

.next-button {
    margin-top: 1rem;
}

.message-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.message-box.visible {
    opacity: 1;
    visibility: visible;
}

.message-box.success {
    background-color: #4CAF50; /* Green */
    color: white;
}

.message-box.error {
    background-color: #f44336; /* Red */
    color: white;
}
