/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: #1a365d;
    color: white;
    padding: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 25px 20px;
    background: #2d3748;
    border-bottom: 1px solid #4a5568;
}

.sidebar-header h3 {
    margin: 0;
    color: white;
    font-size: 1.3em;
    font-weight: 600;
}

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

.sidebar-menu li {
    border-bottom: 1px solid #2d3748;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 18px 20px;
    color: #cbd5e0;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1em;
    border-left: 4px solid transparent;
}

.sidebar-menu a:hover {
    background: #2d3748;
    color: white;
    border-left-color: #7393B3;
    padding-left: 25px;
}

.sidebar-menu a.active {
    background: #2d3748;
    color: white;
    border-left-color: #7393B3;
    font-weight: 600;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    position: relative;
    padding-right: 40px !important;
    cursor: pointer;
}

.dropdown-toggle::after {
    content: '▼';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.dropdown-toggle.active::after {
    transform: translateY(-50%) rotate(180deg);
}

.dropdown-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #2d3748;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.dropdown-menu.active {
    max-height: 80vh; /* Use viewport height instead of fixed value */
    overflow-y: auto; /* Allow scrolling within the dropdown if needed */
}

.dropdown-menu li {
    border-bottom: 1px solid #3a4557;
}

.dropdown-menu a {
    padding-left: 40px !important;
    background: #2d3748;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-menu a:hover {
    background: #3a4557;
    padding-left: 45px !important;
}

/* Ensure the dropdown doesn't get cut off by the footer */
.sidebar-footer {
    padding: 20px;
    background: #2d3748;
    border-top: 1px solid #4a5568;
    margin-top: auto;
    font-size: 0.9em;
    color: #a0aec0;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    padding: 0;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Welcome message */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.welcome-message h1 {
    color: #2d3748;
    margin-bottom: 15px;
}

.main-content #markdown-output {
    line-height: 1.5;
    padding: 40px;
    background: #fafafa;
    min-height: calc(100vh - 80px);
    margin: 0;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #1a365d;
    color: white;
    z-index: 1001;
    padding: 0 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.mobile-menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    min-width: 44px;
    min-height: 44px;
}

.mobile-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 300px;
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .mobile-header {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 60px;
    }
    
    .main-content #markdown-output {
        padding: 20px 15px;
    }

    /* Adjust dropdown for mobile */
    .dropdown-menu a {
        padding-left: 30px !important;
    }
    
    .dropdown-menu a:hover {
        padding-left: 35px !important;
    }
    
    /* Ensure dropdown is fully visible on mobile */
    .dropdown-menu.active {
        max-height: 70vh;
    }
}

/* Medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
}
