:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --light-bg: #f7f9fc;
    --border-color: #e1e4e8;
    --error-color: #e74c3c;
    --sidebar-width: 280px; /* Increased from 250px to 280px */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    min-height: 100vh;
    background-color: var(--primary-color);
    overflow: hidden; /* Prevent body scrolling */
    display: flex; /* Use flexbox for layout */
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* Main layout structure */
.main-content {
    display: flex;
    width: 100%;
    height: 100vh; /* Full viewport height */
    position: relative; /* For absolute positioning of footer */
}

/* Sidebar styles - fixed on the left */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--primary-color);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar nav {
    padding: 20px 0;
    overflow-y: auto; /* Make the nav section scrollable */
    flex-grow: 1; /* Take up available space */
    
    /* Hide scrollbar for Chrome, Safari and Opera */
    &::-webkit-scrollbar {
        display: none;
    }
    
    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

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

.sidebar li {
    margin-bottom: 10px;
}

.sidebar a {
    color: white;
    text-decoration: none;
    margin: 7px 5px;
    padding: 10px;
    display: block;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.sidebar a:hover,
.sidebar a.active {
    background-color: var(--secondary-color);
}

/* Sidebar drag handle */
.sidebar-drag-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--sidebar-width);
    width: 8px;
    background-color: transparent; /* Make background transparent by default */
    cursor: col-resize;
    z-index: 1001;
    transition: background-color 0.2s;
}

.sidebar-drag-handle:hover, 
.sidebar-drag-handle.dragging {
    background-color: rgba(52, 152, 219, 0.5); /* semi-transparent blue when hovered/dragging */
}

.sidebar-drag-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 2px;
    height: 40px;
    width: 4px;
    background-color: rgba(255, 255, 255, 0.3); /* Light gray handle with opacity */
    border-radius: 3px;
    transform: translateY(-50%);
    opacity: 1; /* Always visible */
    transition: background-color 0.2s, opacity 0.2s;
}

.sidebar-drag-handle:hover::after,
.sidebar-drag-handle.dragging::after {
    background-color: var(--secondary-color); /* Blue when hovered */
    opacity: 1; /* Full opacity on hover */
}

/* Make sidebar transition smoothly when not being dragged */
.sidebar:not(.dragging) {
    transition: width 0.2s ease;
}

.rightside:not(.dragging) {
    transition: margin-left 0.2s ease, width 0.2s ease;
}

/* Right side content area */
.rightside {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    height: 100vh; /* Full viewport height */
    overflow: hidden; /* Prevent scrolling in rightside */
}

/* Header styles - sticky at the top of the right side */
header {
    color: white;
    background-color: var(--primary-color);
    padding: 15px 0;
    position: relative; /* Changed from sticky */
    z-index: 900;
    width: 100%;
    flex-shrink: 0; /* Prevent header from shrinking */
}

header h1 {
    margin-bottom: 0;
    padding-left: 0;
}

/* Logo and header styling */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
    height: 50px;
}

.brand-logo {
    height: 60px;
    transition: transform 0.2s ease;
    max-width: 100%;
    vertical-align: middle;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    padding: 10px;
    margin-right: 0px;
    transition: background-color 0.4s ease;
}

.logo-link:hover .brand-logo {
    background-color: lightgray;
}

/* Main content styles */
.content-area {
    flex: 1;
    padding: 25px;
    background-color: var(--light-bg);
    border-radius: 15px;
    margin: 15px;
    overflow-y: auto; /* Keep scroll here */
    max-height: calc(100vh); /* Adjust height to account for header, margins and footer */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Add subtle shadow for depth */
}

.api-intro {
    margin-bottom: 30px;
}

.api-intro h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.api-intro p {
    margin-bottom: 10px;
}

/* Footer styles */
footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    position: static; /* Change from absolute to static to work with flex layout */
    font-size: smaller;
    padding: 10px 0 !important; /* Add padding to footer */
    margin: 0 !important;
    flex-shrink: 0; /* Prevent the footer from shrinking */
    position: relative; /* For absolute positioning of pseudo-element */
    border-top: none; /* Remove existing border */
}

footer::before {
    content: '';
    position: absolute;
    top: 5px; /* Position it 5px from the top instead of directly at the top */
    left: 10%;
    right: 10%;
    height: 1px; /* Thinner line */
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.2) 80%,
        rgba(255, 255, 255, 0)
    );
}

/* Swagger UI customization */
.swagger-ui .info {
    margin: 30px 0;
}

/* Enhanced Swagger UI styling */
.swagger-ui .opblock {
    margin: 0 0 15px;
    border-radius: 4px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Fix for version spans with white backgrounds */
.swagger-ui .info .title small,
.swagger-ui .info .title pre.version,
.swagger-ui .info .title span {
    background-color: transparent !important;
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 4px;
}

.swagger-ui .info .title small.version-stamp {
    background-color: var(--secondary-color) !important;
    color: white;
}

.swagger-ui .opblock .opblock-summary {
    padding: 10px;
}

.swagger-ui .opblock .opblock-summary-method {
    min-width: 80px;
    text-align: center;
}

.swagger-ui .opblock-tag {
    padding: 10px 0;
    margin: 20px 0 10px;
}

.swagger-ui .parameters-container {
    padding: 15px;
}

.swagger-ui table {
    padding: 10px;
}

.swagger-ui td,
.swagger-ui th {
    padding: 10px;
}

.swagger-ui .response-col_status {
    padding: 10px;
    min-width: 80px;
}

.swagger-ui .responses-table {
    margin-bottom: 20px;
}

.swagger-ui .opblock-description-wrapper {
    padding: 15px;
}

/* Example commands section */
.example-commands {
    margin-top: 20px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid var(--secondary-color);
}

.example-commands h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Code block styling */
pre {
    background-color: #f6f8fa;
    border-radius: 3px;
    padding: 16px;
    overflow: auto;
    margin-bottom: 16px;
}

code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
}

/* Error message styling */
.error-message {
    padding: 20px;
    background-color: #fdf2f2;
    color: var(--error-color);
    border-left: 4px solid var(--error-color);
    margin-bottom: 20px;
    border-radius: 3px;
}

/* Style the API section */
.opblock-summary-path {
    margin-left: 1em;
}

.opblock-summary-description {
    margin-left: 1em;
}

.opblock-summary .arrow {
    margin-left: 1em;
}

/* About section when active */
#about-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile menu button - hidden on desktop */
.mobile-menu-button {
    display: none;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 15px;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
}

.mobile-menu-button i {
    font-size: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        overflow-y: auto; /* Enable scrolling on mobile */
    }
    
    .main-content {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .mobile-menu-button {
        display: flex; /* Show menu button on mobile */
    }
    
    header {
        position: sticky;
        top: 0;
        display: flex;
        align-items: center;
        padding: 10px;
        z-index: 1001;
    }
    
    header h1 {
        font-size: 1.2rem;
        padding-left: 0;
    }
    
    .logo-link {
        flex-direction: row;
        align-items: center;
    }
    
    .brand-logo {
        height: 30px;
    }
    
    .synbiohub-logo {
        width: 30px;
        height: 30px;
        margin-right: 10px;
    }
    
    .sidebar {
        width: 100%;
        height: 100vh;
        position: fixed;
        top: 3em;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        padding-bottom: 100px; /* Add extra padding to ensure all links are visible */
    }
    
    .sidebar nav {
        padding: 20px;
    }
    
    .sidebar.active {
        transform: translateX(0);
        display: block;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .rightside {
        margin-left: 0;
        width: 100%;
        height: auto;
        display: flex;
        flex-direction: column;
    }
    
    .content-area {
        margin: 10px;
        border-radius: 10px;
        padding: 20px;
        margin-bottom: 20px;
        overflow-y: auto; /* Keep scrolling enabled on mobile */
        max-height: calc(100vh - 120px); /* Set a height constraint for scrolling */
        flex: 1;
    }
    
    footer {
        position: relative;
        bottom: auto;
        width: 100%;
        margin-left: 0;
        padding: 0 0 10px 0;
    }
    
    footer .container {
        text-align: center;
        padding: 0 10px;
    }
    
    footer p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    footer::before {
        left: 5%;
        right: 5%;
    }
    
    .sidebar-drag-handle {
        display: none; /* Hide drag handle on mobile */
    }
    
    /* Make HTTP method tags square with just one letter on mobile */
    .swagger-ui .opblock .opblock-summary-method {
        min-width: 30px !important;
        width: 30px !important;
        height: 30px !important; /* Make height match width for square appearance */
        padding: 0 !important; /* Remove padding */
        text-align: center;
        font-size: 9px !important;
        font-weight: bold;
        line-height: 30px !important; /* Center text vertically */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Adjust the path and description spacing */
    .swagger-ui .opblock-summary-path {
        margin-left: 0.5em;
        font-size: 12px;
    }
    
    .swagger-ui .opblock-summary-description {
        margin-left: 0.5em;
        font-size: 11px;
    }
    
    /* Adjust the path and description spacing */
    .swagger-ui .opblock-summary-path {
        margin-left: 0.5em;
        font-size: 12px;
        word-break: break-all; /* Break long words */
        max-width: 50%; /* Limit width */
        white-space: normal; /* Allow text to wrap */
        line-height: 1.3;
    }
    
    .swagger-ui .opblock-summary-description {
        margin-left: 0.5em;
        font-size: 11px;
        opacity: 0.8; /* Make description slightly faded */
        max-width: 40%; /* Limit width */
        line-height: 1.2;
        white-space: normal; /* Allow text to wrap */
    }
    
    /* Make operation block more compact */
    .swagger-ui .opblock {
        margin-bottom: 10px;
    }
    
    .swagger-ui .opblock-summary {
        padding: 8px 5px !important;
    }
    
    /* Reduce font size of parameter names and descriptions */
    .swagger-ui .parameters-col_name {
        font-size: 12px;
        word-break: break-all;
    }
    
    .swagger-ui .parameters-col_description {
        font-size: 11px;
    }
    
    .swagger-ui .parameter__name, 
    .swagger-ui .parameter__type {
        font-size: 11px;
    }
    
    .swagger-ui .response-col_status,
    .swagger-ui .response-col_description {
        font-size: 11px;
    }
    
    /* Compact tables */
    .swagger-ui table {
        font-size: 11px;
    }
}