/* Basic Reset for Consistency */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, sans-serif;
    text-align: left;
    padding: 0;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

#sidebar {
    width: 250px;
    height: 20px;
}

#content {
    margin:  10px 270px 10px 270px;
    padding: 20px;
}

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

.nav li a {
    display: block;
    padding: 10px;
    text-decoration: none;
    color: black;
}

/* Change background color of links on hover */
.nav li a:hover {
    background-color: #ddd;
}

#css-rule-display {
    padding: 15px;
    border: 1px solid #e1e8ed;
    background-color: #f8f9fa;
    text-align: left;
    height: 150px; /* Fixed height to prevent jumping */
    position: sticky;
    top: 20px;
    z-index: 100;
    width: calc(100% - 30px);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    backdrop-filter: blur(10px);
    background: rgba(248, 249, 250, 0.95);
}

.interactive-elements {
    margin-top: 30px;
    padding-top: 20px;
}

/* Ensure content doesn't get hidden behind sticky elements */
#content {
    position: relative;
}

/* Improve pre formatting in css-rule-display */
#css-rule-display pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

#css-rule-display pre code {
    background: none;
    padding: 0;
    border: none;
}

/* Add a subtle fade effect when content changes */
#css-rule-display.updating pre {
    opacity: 0.7;
}

/* Improve scrollbar styling for the CSS rule display */
#css-rule-display::-webkit-scrollbar {
    width: 6px;
}

#css-rule-display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#css-rule-display::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#css-rule-display::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.interactive-element {
    width: 150px;
    height: 150px;
    margin: 10px;
    display: inline-block;
    border: 1px solid black;
    text-align: center;
    vertical-align: middle;
    line-height: 20px;
    cursor: pointer;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.keyframe-example {
    animation: spin 1s ease infinite forwards;
}

.columns {
    display: flex;
    flex-direction: row;
}

.column {
    flex: 1;
    padding: 20px;
}

.column:nth-child(1) {
    flex: 1;
    max-width: 110px;
}

.rules .nth-rule {
    cursor: pointer;
    margin-bottom: 10px;
    padding: 5px;
    border: 1px solid #ddd;
    background-color: #f4f4f4;
}

.rules .nth-rule:hover {
    background-color: #e4e4e4;
}

ul.selector-visualizer {
    list-style-type: none;
    padding: 0;
    padding-inline-start: 0;
}

.selector-visualizer li {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    margin: 5px;
    text-align: center;
    background-color: #eee;
    border-radius: 50%;
}

/* Add responsiveness - smaller screens */
@media screen and (max-width: 700px) {
    body {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 20px;
    }

    #content {
        width: 100%;
        margin: 10px;
        padding: 10px;
    }

    .interactive-elements {
        margin-top: 20px;
    }

    #css-rule-display {
        width: calc(100% - 20px);
        height: 120px; /* Smaller on mobile */
        top: 10px;
        margin: 0 10px;
        padding: 12px;
    }
}

.main-sidebar {
    width: 250px;
    background-color: #ffffff;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    border-right: 1px solid #ddd;
}

.sidebar-header {
    min-height: 80px;
    text-align: center;
}

.sidebar-logo {
    max-width: 100px;
    margin-bottom: 10px;
}

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

.sidebar-nav ul li a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-weight: bold;
}

.sidebar-nav ul li a:hover {
    background-color: #e9e9e9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .main-sidebar {
        width: 100%;
        height: 100vh;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
}

.hamburger-menu {
    cursor: pointer;
    padding: 10px;
    background: transparent;
    border-radius: 3px;
    border: 1px solid #ddd;
    margin: 10px;
    position: absolute;
    top: 10px;
    left: 10px;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: #333;
    transition: 0.4s;
}

/* Hide sidebar initially */
.main-sidebar {
    width: 250px;
    transform: translateX(-250px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .main-sidebar {
        width: 100%;
        transform: translateX(-100%);
    }
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 37px;
    line-height: 37px;
    cursor: pointer;
    border-radius: 3px;
    border: 1px solid #ddd;
    height: 47px;
    width: 47px;
    background-color: #ffffff;
}

/* Optional: Style the button on hover */
.close-btn:hover {
    color: #666;
}

header {
    margin-top: 30px;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo-link:active {
    transform: scale(0.98);
}

/* Landing Page Styles - Mobile First */

/* Override the default #content margins for landing page */
.landing-page-body #content {
    margin: 0;
    padding: 0;
}

.landing-page {
    padding: 1rem;
}

/* Hero Section - Mobile */
.hero {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.cta-button {
    display: inline-block;
    background: #4299e1;
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.cta-button:hover {
    background: #3182ce;
}

/* Visualizers Grid - Mobile */
.visualizers-grid {
    margin-bottom: 2rem;
}

.visualizers-grid h2 {
    font-size: 1.5rem;
    text-align: center;
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.visualizer-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.visualizer-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.visualizer-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #4299e1;
}

.visualizer-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.visualizer-card p {
    color: #4a5568;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Features Section - Mobile */
.features {
    background: #f7fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.features h2 {
    font-size: 1.5rem;
    text-align: center;
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.feature {
    text-align: center;
}

.feature h3 {
    font-size: 1.125rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.feature p {
    color: #4a5568;
    line-height: 1.5;
    font-size: 0.875rem;
}

/* Tablet Styles */
@media (min-width: 640px) {
    .landing-page {
        padding: 1.5rem;
    }
    
    .hero {
        padding: 3rem 0;
    }
    
    .hero h1 {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .cta-button {
        padding: 1rem 2rem;
        font-size: 1.125rem;
    }
    
    .visualizer-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .landing-page {
        max-width: 1200px;
        margin: 0 auto;
        padding: 2rem;
    }
    
    .hero {
        padding: 4rem 0;
        margin-bottom: 4rem;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .visualizers-grid {
        margin-bottom: 4rem;
    }
    
    .visualizers-grid h2 {
        font-size: 2rem;
    }
    
    .visualizer-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .visualizer-card {
        padding: 2rem;
    }
    
    .features {
        padding: 3rem;
        border-radius: 12px;
    }
    
    .features h2 {
        font-size: 2rem;
    }
}