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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
    color: #d4d4d4;
}

header {
    background-color: #252526;
    padding: 12px 20px;
    border-bottom: 1px solid #3c3c3c;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
}

header h1 span {
    color: #569cd6;
}

/* Download button and dropdown */
.download-container {
    position: relative;
}

.download-btn {
    background: transparent;
    border: none;
    color: #d4d4d4;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.download-btn:hover {
    background-color: #3c3c3c;
    color: #ffffff;
}

.download-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background-color: #2d2d2d;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.download-dropdown.open {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: #d4d4d4;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover:not(:disabled) {
    background-color: #3c3c3c;
}

.dropdown-item:disabled {
    color: #666;
    cursor: not-allowed;
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pane-header {
    background-color: #2d2d2d;
    padding: 8px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    border-bottom: 1px solid #3c3c3c;
}

.editor-pane {
    border-right: none;
}

/* Divider between panes */
.divider {
    width: 4px;
    background-color: #3c3c3c;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.divider:hover,
.divider.dragging {
    background-color: #569cd6;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.editor-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
    pointer-events: none;
    color: transparent;
}

.editor-highlight .heading {
    color: #569cd6;
    font-weight: bold;
}

.editor-highlight .bold {
    color: #ce9178;
    font-weight: bold;
}

.editor-highlight .italic {
    color: #b5cea8;
    font-style: italic;
}

.editor-highlight .link {
    color: #4ec9b0;
}

.editor-highlight .code {
    color: #d7ba7d;
    background-color: rgba(255, 255, 255, 0.05);
}

.editor-highlight .list {
    color: #c586c0;
}

#editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: transparent;
    color: #d4d4d4;
    border: none;
    outline: none;
    resize: none;
    caret-color: #ffffff;
}

#preview {
    flex: 1;
    padding: 16px 24px;
    overflow-y: auto;
    background-color: #1e1e1e;
}

/* Preview Styling */
#preview h1, #preview h2, #preview h3, 
#preview h4, #preview h5, #preview h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #ffffff;
}

#preview h1 {
    font-size: 2em;
    border-bottom: 1px solid #3c3c3c;
    padding-bottom: 0.3em;
}

#preview h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #3c3c3c;
    padding-bottom: 0.3em;
}

#preview h3 {
    font-size: 1.25em;
}

#preview h4 {
    font-size: 1em;
}

#preview h5 {
    font-size: 0.875em;
}

#preview h6 {
    font-size: 0.85em;
    color: #888;
}

#preview p {
    margin-bottom: 16px;
    line-height: 1.6;
}

#preview a {
    color: #4ec9b0;
    text-decoration: none;
}

#preview a:hover {
    text-decoration: underline;
}

#preview code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.9em;
    background-color: #2d2d2d;
    padding: 2px 6px;
    border-radius: 3px;
    color: #d7ba7d;
}

#preview pre {
    background-color: #2d2d2d;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
}

#preview pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
    color: #d4d4d4;
}

#preview blockquote {
    border-left: 4px solid #569cd6;
    padding-left: 16px;
    margin: 0 0 16px 0;
    color: #888;
}

#preview ul, #preview ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

#preview li {
    margin-bottom: 4px;
    line-height: 1.6;
}

#preview hr {
    border: none;
    border-top: 1px solid #3c3c3c;
    margin: 24px 0;
}

#preview strong {
    font-weight: 600;
    color: #ffffff;
}

#preview em {
    font-style: italic;
}

#preview img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

#preview table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

#preview th, #preview td {
    border: 1px solid #3c3c3c;
    padding: 8px 12px;
    text-align: left;
}

#preview th {
    background-color: #2d2d2d;
    font-weight: 600;
}

.placeholder {
    color: #555;
    font-style: italic;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #3c3c3c;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4c4c4c;
}

/* GitHub floating link */
.github-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px;
    border-radius: 50%;
    background-color: #2d2d2d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 1000;
}

.github-link:hover {
    background-color: #3c3c3c;
}

.github-link img {
    transition: filter 0.2s ease;
}

.github-link:hover img {
    filter: brightness(1.3);
}

/* Mobile Toggle Styles */
.mobile-toggle {
    display: none;
    gap: 4px;
    background-color: #2d2d2d;
    border-radius: 6px;
    padding: 4px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.toggle-btn:hover {
    color: #d4d4d4;
}

.toggle-btn.active {
    background-color: #3c3c3c;
    color: #569cd6;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
    }

    .divider {
        display: none;
    }

    .container.is-mobile .editor-pane,
    .container.is-mobile .preview-pane {
        flex: none;
        width: 100%;
        display: none;
    }

    .container.is-mobile.mobile-editor-active .editor-pane {
        display: flex;
    }

    .container.is-mobile.mobile-preview-active .preview-pane {
        display: flex;
    }

    .github-link {
        bottom: 10px;
        right: 10px;
        padding: 8px;
    }

    .github-link img {
        width: 20px;
        height: 20px;
    }

    header {
        padding: 10px 12px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .pane-header {
        padding: 6px 12px;
    }

    #editor {
        padding: 12px;
        font-size: 13px;
    }

    .editor-highlight {
        padding: 12px;
        font-size: 13px;
    }

    #preview {
        padding: 12px 16px;
    }
}
