:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --text-color: #212529;
    --card-background: #ffffff;
    --border-color: #dee2e6;
    --code-background: #e9ecef;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    display: flex;
}

.sidebar {
    width: 240px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: var(--card-background);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

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

.sidebar li a {
    display: block;
    padding: 10px 15px;
    color: var(--secondary-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
    font-weight: 500;
}

.sidebar li a:hover {
    background-color: var(--code-background);
}

.sidebar li a.active {
    background-color: var(--primary-color);
    color: white;
}

.main-content {
    margin-left: 240px;
    padding: 40px;
    width: calc(100% - 240px);
}

.main-header {
    text-align: center;
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: bold;
}

section {
    margin-bottom: 4rem;
    padding-top: 2rem;
}

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

article {
    background: var(--card-background);
    padding: 20px;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

article h3 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.interactive-demo {
    margin-top: 1.5rem;
    padding: 20px;
    background-color: #fdfdfe;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.interactive-demo h4 {
    margin-top: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.code-display {
    background-color: var(--code-background);
    padding: 15px;
    border-radius: 5px;
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
    margin-top: 1rem;
    white-space: pre-wrap;
}

.code-display span {
    font-weight: bold;
    color: var(--primary-color);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #0056b3;
}

input[type="range"] {
    width: 100%;
}

.endian-container {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
}

.endian-box {
    text-align: center;
}

.memory-layout {
    display: flex;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    margin-top: 0.5rem;
}

.memory-layout span {
    padding: 10px;
    font-family: monospace;
    border-left: 1px solid var(--secondary-color);
}

.memory-layout span:first-child {
    border-left: none;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.tab-link {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--secondary-color);
    border-bottom: 3px solid transparent;
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.tab-content.active {
    display: block;
}

.steps-container {
    margin-bottom: 1rem;
}

.step {
    padding: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 5px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.step.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.memory-visual {
    height: 60px;
    border: 2px dashed var(--secondary-color);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-family: monospace;
    transition: all 0.5s;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
}
