/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f8fafc;
    color: #334155;
    padding-top: 3rem;
}

hr {
    margin: 7px 0;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, #059669, #52d3a6);
    color: white;
    padding: 1.2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-toggle {
    position: absolute;
    left: 1.2rem;
    width: 30px;
    height: 25px;
    cursor: pointer;
    display: none;
    flex-direction: column;
    justify-content: space-around;
}

.menu-toggle span {
    height: 3px;
    width: 100%;
    background-color: white;
    border-radius: 5px;
    transition: all 0.3s ease;
}

/* Layout */
.container {
    display: flex;
    flex: 1;
    height: calc(100vh - 150px);
}

.sidebar {
    width: 250px;
    background: #f1f5f9;
    color: #0f172a;
    padding: 3rem 1rem;
    overflow-y: auto;
    position: fixed;
    height: calc(100% - 10px);
    border-right: 1px solid #e2e8f0;
    transition: transform 0.3s ease;
}

.sidebar h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #10b981;
    text-align: center;
    color: #059669;
}

.chapters {
    list-style: none;
}

.chapters li {
    margin-bottom: 0.8rem;
}

.chapters a {
    display: block;
    color: #475569;
    text-decoration: none;
    padding: 0.7rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.chapters a:hover {
    background: #d1fae5;
    color: #065f46;
    transform: translateX(5px);
}

.main-content {
    flex: 1;
    padding: 2rem;
    margin-left: 250px;
    overflow-y: auto;
    background: white;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh);
}

.content-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e8e8e8;
    color: #2d6a4f;
    text-align: center;
}

/* Iframe */
.iframe-container {
    flex: 1;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.content-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Canvas & Info Card */
.canvas {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-height: 400px;
    border: 1px solid #e2e8f0;
}

.canvas h2 {
    color: #059669;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.info-card {
    background: #f0fdf4;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #d1fae5;
}

.info-card h3 {
    color: #065f46;
    margin-bottom: 1rem;
}

.info-card p {
    margin-bottom: 0.5rem;
    padding: 0.3rem 0;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #39bd7f;
    color: #334155;
    padding: 0.5rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-top: 1px solid #e2e8f0;
}



.nav-button {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.nav-button:hover {
    background: #059669;
}

.disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

.disabled:hover {
    background: #cbd5e1;
}

/* Chapter/Tag Sections */
.chapter-header {
    position: sticky;
    color: #2d6a4f;
    background-color: #acf1d1;
    border-radius: 5px;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
    border-bottom: 2px solid #e8e8e8;
    text-align: center;
    z-index: 500;
    top: 0px;
}

.tag-section {
    margin: 2rem 0;
    padding: 1.5rem;
    border-left: 4px solid #40916c;
    background-color: #f8f9fa;
    border-radius: 0 8px 8px 0;
}

.tag-section h3 {
    color: #1b4332;
    margin-bottom: 1rem;
}

.tag-demo {
    padding: 1rem;
    background: white;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Specific Example Styling */
.html-demo,
.body-demo {
    background: #f1f8e9;
    padding: 1rem;
    border-radius: 4px;
}

.head-demo,
.doctype-demo {
    background: #e8f5e9;
    padding: 1rem;
    border-radius: 4px;
}

.doctype-demo {
    font-family: monospace;
}

.tag-example {
    margin: 1.5rem 0;
    padding: 1rem;
    border-left: 4px solid #10b981;
    background-color: #f8fafc;
}

.tag-example h4 {
    color: #065f46;
    margin-bottom: 0.5rem;
}

/* Content Styles */
.content-sample {
    margin: 1.5rem 0;
}

.content-sample h3 {
    color: #059669;
    margin-bottom: 0.5rem;
}

code {
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
    color: #475569;
}

pre {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
}

blockquote {
    border-left: 4px solid #10b981;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #475569;
    font-style: italic;
}

/* Checkbox hack for mobile menu */
#menu-toggle {
    display: none;
}

.overlay {
    position: fixed;
    top: 3rem;
    left: 0;
    width: 100%;
    height: calc(100% - 15px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

#menu-toggle:checked ~ .overlay {
    display: block;
}

/* Responsive Design */
@media (max-width: 900px) {
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 80px;
        left: 0;
        height: calc(100% - 150px);
        transform: translateX(-100%);
        z-index: 999;
        width: 250px;
        background: #1b4332;
        color: white;
    }
    
    .sidebar h2 {
        color: white;
        border-bottom: 2px solid #52b788;
    }
    
    .chapters a {
        color: #d8f3dc;
    }
    
    .chapters a:hover {
        background: #2d6a4f;
        color: white;
    }
    
    #menu-toggle:checked ~ .container .sidebar {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    footer {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.1rem;
        padding-left: 2rem;
    }
    
    .menu-toggle {
        left: 1rem;
        width: 20px;
        height: 20px;
    }
    
    .nav-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .main-content,
    .canvas,
    .tag-section,
    .tag-demo {
        padding: 1rem;
    }
    
    .chapters {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .chapters li {
        margin-bottom: 0;
    }
    
    .chapters a {
        padding: 0.5rem 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 50px;
    }
    
    .chapters {
        justify-content: space-between;
    }
    
    .chapters a {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }

    .chapter-header {
        font-size: 1.2rem;
    }
}
