:root {
    --primary-color: #007bff;
    --hover-color: #0056b3;
    --success-color: #28a745;
    --info-color: #007bff;
    --error-color: #dc7b35;
    --text-color: #333;
    --background-light: #f9f9f9;
    --background-dark: #f0f0f0;
    --border-radius: 4px;
    --font-size: 14px;
    --padding: 8px 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #1e90ff;
        --hover-color: #1c7ed6;
        --success-color: #38d9a9;
        --info-color: #1e90ff;
        --error-color: #dc7b35;
        --text-color: #f1f1f1;
        --background-light: #2c2c2c;
        --background-dark: #1c1c1c;
    }

    body {
        background-color: var(--background-dark);
        color: var(--text-color);
    }

    .editor-container,
    .right-nav,
    .floating-buttons,
    section {
        background-color: var(--background-light);
        color: var(--text-color);
    }

    .line-numbers {
        background-color: var(--background-dark);
    }

    .toast {
        color: var(--text-color);
    }

    .copy-button svg {
        fill: var(--text-color);
    }

    #fileList li {
        background-color: var(--background-light);
    }

    #fileList li:hover {
        background-color: var(--background-light);
    }

    footer {
        background-color: var(--background-light);
        color: var(--text-color);
    }
}

/* Common button styles */
button,
.floating-buttons button,
.copy-button,
.right-nav button,
.right-nav .button-container button,
.right-nav .close-button-side,
.close-button {
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    padding: var(--padding);
    font-size: var(--font-size);
    height: auto;
}

button:hover,
.floating-buttons button:hover,
.copy-button:hover,
.right-nav button:hover,
.right-nav .button-container button:hover,
.right-nav .close-button-side:hover,
.close-button:hover {
    background-color: var(--hover-color);
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    font-family: Verdana, Arial, sans-serif;
}

.editor-container {
    position: relative;
    height: 100vh;
}

/* Set up the scroll wrapper */
.scroll-wrapper {
    display: flex;
    height: 100vh;
    overflow: auto;
    position: relative;
}

.line-numbers {
    flex: 0 0 auto;
    height: 100%;
    width: 40px;
    text-align: right;
    font-size: 14px;
    line-height: 20px;
    font-family: monospace;
}

.editable-div {
    flex: 1 1 auto;
    padding-left: 10px;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 20px;
    font-family: monospace;
}

.editable-div::-webkit-scrollbar {
    display: none;
}

.floating-buttons {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

@media (prefers-color-scheme: dark) {
    .floating-buttons {
        background-color: rgba(30, 30, 30, 0.9);
    }
}

/* Legacy JSON highlighting classes - now handled by Prism.js
.json-string {
    color: #22863a;
}

.json-number {
    color: #005cc5;
}

.json-boolean,
.json-null {
    color: var(--error-color);
}

.json-key {
    color: #e36209;
}
*/

.editable-div[contenteditable=true]:empty:before {
    content: 'Enter JSON here';
    color: #888;
    font-style: italic;
}

.toast {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-size: var(--font-size);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.toast.success {
    background-color: var(--success-color);
}

.toast.info {
    background-color: var(--info-color);
}

.toast.error {
    background-color: var(--error-color);
}

.toast.show {
    opacity: 1;
}

.copy-button svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
    font-size: 9px;
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
}

.close-button {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: none;
    padding: 10px 25px
}

.close-button-side {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
}

.button-container {
    margin-bottom: 40px;
}

.button-container button {
    white-space: normal;
    /* Allow text to wrap */
    width: 120px;
    /* Adjust width as needed */
    text-align: center;
    /* Center align text */

}

.hidden-line {
    display: none;
}

.collapsed-line {
    color: var(--primary-color);
}

.collapse-placeholder {
    color: #888;
    font-style: italic;
    cursor: pointer;
}

.full-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-light);
    overflow: auto;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

section {
    background-color: var(--background-light);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

section h3 {
    color: var(--text-color);
    margin-top: 0;
}

section p {
    color: var(--text-color);
    line-height: 1.6;
}

section ul {
    padding-left: 20px;
}

section li {
    margin-bottom: 10px;
}

section a {
    color: var(--primary-color);
    text-decoration: none;
}

section a:hover {
    text-decoration: underline;
}

.shortcut {
    font-size: 0.6em;
    color: #ccc;
}

.right-nav {
    position: fixed;
    right: -290px;
    top: 0;
    width: 250px;
    height: 100%;
    background-color: var(--background-dark);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    transition: right 0.3s ease;
    z-index: 1000;
}

.right-nav.open {
    right: 0;
}

#fileList {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column-reverse;
}

#fileList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    margin-bottom: 5px;
    background-color: var(--background-light);
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
    overflow: hidden;
}

#fileList li:hover {
    background-color: #e9e9e9;
}

#fileList span {
    flex-grow: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#fileList .file-date {
    font-size: 0.5em;
    color: #888;
}

#fileList button {
    flex-shrink: 0;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 8px;
    color: var(--primary-color);
    transition: color 0.3s ease;
    padding: 4px;
}

#fileList button:hover {
    color: var(--hover-color);
}

footer {
    text-align: center;
    padding: 20px;
    background-color: var(--background-light);
    color: var(--text-color);
}

/* Media query for mobile devices */
@media (max-width: 768px) {
    .shortcut {
        display: none;
        /* Hide shortcut elements */
    }

    .right-nav {
        width: 90vw;
        /* Make right-nav fullscreen */
        height: 100vh;
        top: 0;
        right: 0;
        position: fixed;
        z-index: 2000;
        display: none;
        /* Ensure it is on top */
    }

    .right-nav.open {
        display: block;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
    }

    .right-nav .button-container {
        position: absolute;
        bottom: 30px;
    }

    #fileList {
        margin-top: 50px;
        margin-bottom: 20px;
    }
}


/* Add these styles to your styles.css */

.code-line {
    white-space: pre-wrap;
}


.line-numbers .collapsible-line {
    cursor: pointer;
    color: var(--primary-color);
    background-color: var(--background-dark);
    box-sizing: border-box;
    padding-right: 10px;
    width: 100%;
    border-right: 1px solid #444;

}


/* Indicate collapsed or expanded state */
.line-numbers .collapsible-line::after {
    content: attr(data-indicator);
    font-size: 8px;
    margin-left: 2px;
    line-height: 10px;
    vertical-align: middle;
}

.line-numbers div:not(.collapsible-line) {
    background-color: var(--background-dark);
    box-sizing: border-box;
    padding-right: 16px;
    width: 100%;
    border-right: 1px solid #444;

}