:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3f7;
    --text-color: #333;
    --light-bg: #dadada;
    --dark-bg: #2d333b;
    --success-color: #4caf50;
    --error-color: #f44336;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    display: flex;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 100%;
    height: 100dvh;
    position: relative; /* Added to properly position children */
    flex-direction: row-reverse; /* Reverse to move sidebar to right */
}

header {
    text-align: center;
    padding: 2rem;
    background-color: var(--primary-color);
    color: white;
    position: absolute;
    width: calc(100% - 14dvw);
    left: 0; /* Changed from right to left */
    height: auto; /* Changed from fixed height */
    min-height: 8rem;
    z-index: 5;
}

header h1 {
    margin-bottom: 0.5rem;
}

.sidebar {
    background-color: var(--dark-bg);
    color: white;
    padding: 2rem;
    width: 14dvw;
    min-width: 180px;
    position: relative;
    z-index: 10;
    height: 100dvh;
    overflow-y: auto;
    /* No need to change position since we're using flex-direction: row-reverse */
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 1rem;
}

.sidebar .tab-button,
.sidebar .external-link {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: white;
    text-align: left;
    opacity: 0.7;
    display: block;
    text-decoration: none;
}

.sidebar .tab-button.active {
    background-color: var(--accent-color);
    opacity: 1;
    font-weight: 500;
}

.sidebar .external-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

main {
    flex: 1;
    padding: 2rem;
    padding-top: 10rem;
    z-index: 1;
    overflow-y: auto;
    height: 100dvh;
    width: calc(100% - 14dvw);
    position: absolute;
    left: 0;
    background-color: var(--light-bg);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

textarea {
    resize: vertical;
    height: 100px;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

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

.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
}

.message.success {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.message.error {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--error-color);
}

.message.warning {
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    color: #856404;
}

.user-info {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.user-info p {
    margin-bottom: 0.75rem;
}

.api-docs {
    margin-bottom: 1.5rem;
}

.api-docs h3 {
    margin-bottom: 0.5rem;
}

pre {
    background-color: var(--dark-bg);
    color: white;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

code {
    font-family: 'Courier New', Courier, monospace;
}

footer {
    margin-top: 2rem;
    text-align: center;
    color: #666;
    font-size: 0.875rem;
}

footer.site-footer {
    background-color: var(--dark-bg);
    color: rgba(255, 255, 255, 0.7);
    padding: 1rem;
    font-size: 0.8rem;
    text-align: center;
    position: absolute;
    bottom: 0;
    left: 0;
    width: calc(100% - 14dvw);
    z-index: 10;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
}

.footer-content p {
    margin: 0.2rem 0;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    font-size: 1.5rem;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 20;
    cursor: pointer;
    border-radius: 4px;
}

/* Copy button styling */
.btn-small {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.3rem 0.7rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* Add media queries for responsiveness */
@media screen and (max-width: 992px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        display: flex;
        justify-content: center;
        z-index: 15;
    }
    
    .sidebar ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .sidebar li {
        margin: 0.5rem;
    }
    
    header {
        width: 100%;
        position: relative;
        padding: 1.5rem;
    }
    
    main {
        width: 100%;
        position: relative;
        padding-top: 2rem;
        height: auto;
    }

    footer.site-footer {
        width: 100%;
        position: relative;
        order: 3; /* Make sure footer appears at the bottom */
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        box-shadow: none;
    }
    
    .sidebar {
        padding: 1rem 0.5rem;
    }
    
    .sidebar .tab-button,
    .sidebar .external-link {
        padding: 0.5rem 0.1rem;
        font-size: 0.8rem;
    }
    
    main {
        padding: 1.5rem;
    }
    
    input, textarea, .btn {
        font-size: 16px; /* Prevents zoom on input focus on iOS */
    }
    
    .user-info {
        overflow-wrap: break-word;
        word-break: break-all;
    }
    
    pre {
        max-width: 100%;
        overflow-x: auto;
    }

    footer.site-footer {
        padding: 0.8rem;
        font-size: 0.7rem;
    }
}

@media screen and (max-width: 576px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .sidebar {
        overflow-x: auto;
    }
    
    .sidebar ul {
        flex-wrap: nowrap;
        width: max-content;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    footer.site-footer {
        padding: 0.7rem 0.5rem;
    }
}