:root {
    --primary: #1a1b26;
    --secondary: #4CAF50;
    --accent: #6ee7b7;
    --text: #e2e8f0;
    --text-dark: #1a1b26;
    --background: #0f1117;
    --card-bg: #1f2937;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    background-color: var(--primary);
    width: var(--sidebar-collapsed-width);
    transition: width var(--transition-speed);
    z-index: 1000;
    padding-top: 1rem;
}

.sidebar:hover {
    width: var(--sidebar-width);
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: var(--text);
    text-decoration: none;
    transition: background-color var(--transition-speed);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-item:hover {
    background-color: var(--secondary);
}

.sidebar-item i {
    min-width: 2rem;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.sidebar-item span {
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.sidebar:hover .sidebar-item span {
    opacity: 1;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-collapsed-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left var(--transition-speed);
}

.sidebar:hover + .main-content {
    margin-left: var(--sidebar-width);
}

/* Card Styles */
.card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
}

/* Panda Animation */
.panda-container {
    width: 300px;
    height: 300px;
    margin: 2rem auto;
    position: relative;
}

.panda {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-origin: center;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Code Snippets */
pre {
    background-color: var(--primary);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    margin: 1rem 0;
}

code {
    font-family: 'JetBrains Mono', monospace;
}

/* Search Bar */
.search-container {
    position: relative;
    margin-bottom: 2rem;
}

.search-bar {
    width: 100%;
    padding: 1rem;
    background-color: var(--card-bg);
    border: 2px solid var(--secondary);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.search-bar:focus {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

/* Utilities */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--secondary);
    color: var(--text-dark);
    border-radius: 1rem;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.highlight {
    color: var(--accent);
    font-weight: 600;
}

/* Definition Box */
.definition-box {
    background-color: var(--card-bg);
    border-left: 4px solid var(--secondary);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
}

.definition-box h2 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

/* Tip Container */
.tip-container {
    padding: 0.5rem;
}

.tip-container h3 {
    margin-bottom: 1rem;
    color: var(--accent);
}

.tip-container ul {
    list-style-position: inside;
    padding-left: 1rem;
}

.tip-container li {
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 240px;
        --sidebar-collapsed-width: 0px;
    }

    body {
        overflow-x: hidden;
    }

    /* Mobile Sidebar */
    .sidebar {
        width: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease, width 0.3s ease;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        background: var(--primary);
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        opacity: 0;
        visibility: hidden;
    }
    
    .sidebar.active {
        width: 85%;
        max-width: 300px;
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }

    /* Show sidebar text on mobile when active */
    .sidebar-item span {
        opacity: 1;
        display: inline-block;
        margin-left: 1rem;
    }

    /* Keep icon size consistent */
    .sidebar-item i {
        font-size: 1.2rem;
        width: 1.5rem;
        text-align: center;
    }

    /* Add overlay when sidebar is active */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        transition: none;
        position: relative;
        min-height: 100vh;
    }

    /* Remove the transform on main content */
    .main-content.sidebar-active {
        transform: none;
    }

    /* Mobile Menu Button */
    .mobile-menu-btn {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1001;
        background: var(--secondary);
        border: none;
        border-radius: 50%;
        width: 3rem;
        height: 3rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    .mobile-menu-btn i {
        color: var(--text-dark);
        font-size: 1.2rem;
    }

    /* Mobile Search */
    .search-container {
        margin-top: 3.5rem;
    }

    .search-results {
        max-height: 50vh;
    }

    /* Mobile Cards */
    .card {
        margin-bottom: 1rem;
        padding: 1rem;
        background-color: var(--card-bg);
    }

    /* Mobile Tags */
    .tags-container {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .tag {
        margin: 0;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    /* Mobile Definition Box */
    .definition-box {
        margin: 1rem 0;
        padding: 1rem;
    }

    /* Mobile Panda */
    .panda-container {
        width: 200px;
        height: 200px;
        margin: 1rem auto;
    }

    /* Code Blocks */
    pre {
        font-size: 0.875rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem;
        margin: 0.5rem 0;
    }

    /* Fix Mobile Touch Areas */
    .sidebar-item {
        padding: 1rem;
        min-height: 44px; /* Apple's recommended minimum touch target size */
    }

    .search-result-item {
        min-height: 44px;
        padding: 0.75rem;
    }

    /* Mobile Text Adjustments */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    p { font-size: 1rem; }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .card {
        padding: 0.75rem;
    }

    .tag {
        padding: 0.4rem 0.8rem;
        font-size: 0.8125rem;
    }

    .panda-container {
        width: 150px;
        height: 150px;
    }

    pre {
        font-size: 0.8125rem;
    }
}

/* Handle Device Orientation */
@media (max-height: 600px) and (orientation: landscape) {
    .panda-container {
        display: none;
    }

    .sidebar {
        padding-top: 0.5rem;
    }

    .sidebar-item {
        padding: 0.75rem 1rem;
    }
}
