/**
 * --------------------------------------------------------------------
 * docmd : the minimalist, zero-config documentation generator.
 *
 * @package     @docmd/core (and ecosystem)
 * @website     https://docmd.io
 * @repository  https://github.com/docmd-io/docmd
 * @license     MIT
 * @copyright   Copyright (c) 2025 docmd.io
 *
 * [docmd-source] - Please do not remove this header.
 * --------------------------------------------------------------------
 */

 :root {
    --header-height: 50px;
    --border-color: #e0e0e0;
    --bg-color: #f9fafb;
    --primary-color: #007bff;
    --resizer-width: 8px
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden
}

.top-bar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    flex-shrink: 0
}

.logo {
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px
}

.logo span {
    background: var(--primary-color);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .75rem;
    text-transform: uppercase
}

.back-link {
    display: flex;
    width: 24px;
    height: 24px;
    background-color: #f0f0f0;
    border-radius: 100%;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.2s, transform .2s;
    text-decoration: none;
    padding: 4px;
}

.back-link:hover {
    color: var(--primary-color);
    background: #f0f0f0;
    transform: translateX(-2px)
}

.logo .docmd-logo {
    color: inherit;
    text-decoration: none;
    transition: .5s;
}

.logo .docmd-logo:hover {
    color: var(--primary-color);
}

.view-switcher {
    display: flex;
    background: #f0f0f0;
    padding: 3px;
    border-radius: 8px;
    gap: 0;
}

.view-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.view-btn:hover {
    color: #333;
}

.view-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 3px #0000001a;
    font-weight: 600;
}

.workspace {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden
}

.pane {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    background: #fff
}

.pane-header {
    padding: 0 16px;
    height: 40px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.editor-pane {
    width: 50%
}

.presets-bar {
    display: flex;
    gap: 6px;
}

.presets-bar button {
    background: #eef2f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 10px;
    color: #666;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 600;
    transition: all 0.2s;
}

.presets-bar button:hover {
    background: #fff;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

textarea#input {
    flex: 1;
    border: none;
    resize: none;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    background: var(--bg-color)
}

.preview-pane {
    flex: 1;
    background: #fff
}

.iframe-wrapper {
    width: 100%;
    height: 100%;
    background: #fff;
    position: relative;
}

iframe#preview {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    transition: opacity 0.15s ease-in-out;
    opacity: 1;
}

.iframe-wrapper.rendering iframe {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.resizer {
    width: var(--resizer-width);
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    z-index: 10
}

.resizer:hover,
.resizer.resizing {
    background: #e0e0e0
}

.resizer::after {
    content: "||";
    color: #aaa;
    font-size: 10px;
    letter-spacing: 1px
}

body.mode-single .resizer {
    display: none
}

body.mode-single .pane {
    width: 100% !important;
    min-width: 0
}

body.mode-single .editor-pane {
    display: none
}

body.mode-single .preview-pane {
    display: none
}

body.mode-single.show-editor .editor-pane {
    display: flex
}

body.mode-single.show-preview .preview-pane {
    display: flex
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important
    }

    .resizer {
        display: none !important
    }

    .pane {
        width: 100% !important
    }

    .editor-pane {
        display: none
    }

    .preview-pane {
        display: none
    }

    body.mobile-tab-editor .editor-pane {
        display: flex
    }

    body.mobile-tab-preview .preview-pane {
        display: flex
    }

    .mobile-tabs {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        background: #fff;
        border-top: 1px solid var(--border-color);
        z-index: 100
    }

    .mobile-tab-btn {
        flex: 1;
        border: none;
        background: transparent;
        font-weight: 600;
        color: #888;
        cursor: pointer
    }

    .mobile-tab-btn.active {
        color: var(--primary-color);
        border-top: 2px solid var(--primary-color)
    }

    .workspace {
        padding-bottom: 50px
    }
}

.mobile-tabs {
    display: none
}