* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0a0a0a;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background-color: #0f0f0f;
    border-bottom: 2px solid #1F5F9F;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 157, 225, 0.1);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-link {
    text-decoration: none;
    display: block;
}

.nav-brand img {
    height: 40px;
    width: auto;
    transition: transform 0.2s ease;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 6px 10px;
    border-radius: 4px;
}

.back-link:hover {
    color: #009DE1;
    background-color: rgba(0, 157, 225, 0.1);
}

.back-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1F5F9F;
    transition: all 0.2s ease;
    width: 16px;
    height: 16px;
}

.back-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.back-link:hover .back-icon {
    color: #009DE1;
    transform: translateX(-3px);
}

.back-text {
    white-space: nowrap;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    padding-right: 12px;
}

.btn {
    background: #1F5F9F;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.06);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    position: relative;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn::before, .btn::after { content: none; }

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(31,95,159,0.12);
    opacity: 0.98;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(31,95,159,0.08);
}

.btn-new, .btn-save { background: #1F5F9F; }

.language-selector {
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #1F5F9F;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.language-selector:hover {
    border-color: #009DE1;
    background: #222222;
}

.language-selector:focus {
    border-color: #009DE1;
    box-shadow: 0 0 0 2px rgba(0, 157, 225, 0.2);
}

.editor-container {
    flex: 1;
    display: flex;
    background-color: #0a0a0a;
    overflow: hidden;
}

.line-numbers {
    display: none;
}

.line-numbers span {
    display: block;
    padding-right: 8px;
}

.editor-content {
    flex: 1;
    position: relative;
}

.code-editor-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#cm-root { 
    width: 100%; 
    height: 100%; 
}

.simple-editor-container {
    display: flex;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
}

.editor-wrapper {
    flex: 1;
    position: relative;
}

.code-minimap {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 140px;
    height: 200px;
    background: rgba(15, 15, 15, 0.92);
    border: 1px solid #1F5F9F;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 10;
    cursor: crosshair;
    user-select: none;
}

.code-minimap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.minimap-viewport {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 20px;
    border: 1px solid #009DE1;
    background: rgba(0, 157, 225, 0.12);
    pointer-events: none;
}

.line-numbers-simple {
    background-color: #111111;
    color: #1F5F9F;
    padding: 20px 8px;
    text-align: right;
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    font-size: 15.5px;
    line-height: 1.6;
    min-width: 50px;
    max-width: 80px;
    border-right: 2px solid #1F5F9F;
    overflow: hidden;
    user-select: none;
}

.line-numbers-simple span {
    display: block;
    padding-right: 8px;
}

.simple-editor {
    width: 100%;
    height: 100%;
    background: transparent;
    color: transparent;
    border: none;
    outline: none;
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    font-size: 15.5px;
    line-height: 1.6;
    padding: 20px;
    resize: none;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    caret-color: #009DE1;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.simple-editor::placeholder {
    color: #1F5F9F;
    font-style: italic;
}

.simple-editor::selection {
    background-color: rgba(0, 157, 225, 0.25);
}

.syntax-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
    margin: 0;
    padding: 20px;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    font-size: 15.5px;
    line-height: 1.6;
    z-index: 1;
    pointer-events: none;
    color: #e0e0e0;
    border: none;
    box-sizing: border-box;
}

.syntax-overlay code {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

.token.comment { color: #6a9955 !important; }
.token.string { color: #ce9178 !important; }
.token.number { color: #b5cea8 !important; }
.token.boolean { color: #569cd6 !important; }
.token.keyword { color: #009DE1 !important; }
.token.property { color: #9cdcfe !important; }
.token.punctuation { color: #d4d4d4 !important; }
.token.operator { color: #d4d4d4 !important; }
.token.class-name { color: #4ec9b0 !important; }
.token.function { color: #dcdcaa !important; }
.token.selector { color: #d7ba7d !important; }
.token.rule { color: #c586c0 !important; }
.token.atrule { color: #c586c0 !important; }
.token.url { color: #3dc9b3 !important; }
.token.important { color: #ff6b6b !important; }

.syntax-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
    margin: 0;
    padding: 20px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    font-size: 15.5px;
    line-height: 1.6;
    z-index: 1;
    pointer-events: none;
    letter-spacing: 0;
    word-spacing: 0;
    tab-size: 2;
    -moz-tab-size: 2;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0, "ss01" 0;
}

.syntax-highlight code {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    word-spacing: inherit !important;
}

.token.comment { color: #6a9955 !important; }
.token.string { color: #ce9178 !important; }
.token.number { color: #b5cea8 !important; }
.token.boolean { color: #569cd6 !important; }
.token.keyword { color: #009DE1 !important; }
.token.property { color: #9cdcfe !important; }
.token.punctuation { color: #d4d4d4 !important; }
.token.operator { color: #d4d4d4 !important; }
.token.class-name { color: #4ec9b0 !important; }
.token.function { color: #dcdcaa !important; }

.simple-editor::-webkit-scrollbar,
.line-numbers-simple::-webkit-scrollbar,
.language-selector::-webkit-scrollbar {
    width: 8px;
}

.simple-editor::-webkit-scrollbar-track,
.line-numbers-simple::-webkit-scrollbar-track,
.language-selector::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.simple-editor::-webkit-scrollbar-thumb,
.line-numbers-simple::-webkit-scrollbar-thumb,
.language-selector::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #1F5F9F, #009DE1);
    border-radius: 4px;
    border: 1px solid #009DE1;
}

.simple-editor::-webkit-scrollbar-thumb:hover,
.line-numbers-simple::-webkit-scrollbar-thumb:hover,
.language-selector::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #357ABD, #2AC7FF);
}

@media (min-width: 769px) and (max-width: 1024px) {
    .navbar {
        padding: 10px 16px;
        height: 65px;
    }

    .nav-brand {
        gap: 12px;
    }

    .nav-brand img {
        height: 36px;
    }

    .back-link {
        font-size: 13px;
        padding: 8px 12px;
    }

    .language-selector {
        font-size: 12px;
        padding: 8px 12px;
        max-width: 200px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }

    .nav-buttons {
        gap: 10px;
    }

    .simple-editor {
        font-size: 14px;
        padding: 18px;
    }

    .line-numbers-simple {
        font-size: 14px;
        padding: 18px 10px;
        min-width: 55px;
    }

    .syntax-overlay,
    .syntax-highlight {
        font-size: 14px;
        padding: 18px;
    }

    .code-minimap {
        width: 120px;
        height: 170px;
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .container {
        min-height: 100vh;
    }

    .navbar {
        padding: 8px 12px;
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-brand {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
        width: 100%;
    }

    .nav-brand img {
        height: 32px;
    }

    .back-link {
        font-size: 12px;
        padding: 6px 10px;
        align-self: flex-start;
    }

    .back-text {
        display: none;
    }

    .nav-center {
        width: 100%;
        order: 3;
        margin-top: 8px;
    }

    .language-selector {
        width: 100%;
        font-size: 14px;
        padding: 12px 16px;
        text-align: center;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23009DE1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 40px;
    }

    .nav-buttons {
        gap: 8px;
        justify-content: flex-end;
        flex: 1;
        order: 2;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 40px;
        font-weight: 600;
        border-radius: 6px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .btn:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(31,95,159,0.2);
    }

    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    .editor-container {
        flex-direction: column;
        overflow: visible;
    }

    .simple-editor-container {
        flex-direction: column;
        min-height: calc(100vh - 120px);
    }

    .line-numbers-simple {
        display: none;
    }

    .editor-wrapper {
        position: relative;
        min-height: calc(100vh - 120px);
    }

    .simple-editor {
        font-size: 16px;
        line-height: 1.5;
        padding: 16px;
        border: none;
        outline: none;
        resize: none;
        min-height: calc(100vh - 120px);
        touch-action: manipulation;
    }

    .simple-editor:focus {
        outline: none;
        border: none;
    }

    .syntax-overlay,
    .syntax-highlight {
        font-size: 16px;
        line-height: 1.5;
        padding: 16px;
        min-height: calc(100vh - 120px);
    }

    .code-minimap {
        display: none;
    }

    .simple-editor::-webkit-scrollbar {
        width: 8px;
    }

    .simple-editor::-webkit-scrollbar-track {
        background: transparent;
    }

    .simple-editor::-webkit-scrollbar-thumb {
        background: rgba(31, 95, 159, 0.5);
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 6px 8px;
    }

    .nav-brand {
        gap: 6px;
    }

    .nav-brand img {
        height: 28px;
    }

    .back-link {
        padding: 4px 8px;
    }

    .back-icon {
        width: 14px;
        height: 14px;
    }

    .language-selector {
        font-size: 13px;
        padding: 10px 14px;
        padding-right: 36px;
        background-size: 14px;
        background-position: right 10px center;
    }

    .nav-buttons {
        gap: 6px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 36px;
    }

    .simple-editor {
        font-size: 16px;
        padding: 12px;
        min-height: calc(100vh - 100px);
    }

    .syntax-overlay,
    .syntax-highlight {
        font-size: 16px;
        padding: 12px;
        min-height: calc(100vh - 100px);
    }

    .editor-wrapper,
    .simple-editor-container {
        min-height: calc(100vh - 100px);
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        height: auto;
        min-height: 50px;
        padding: 6px 12px;
    }

    .nav-brand {
        flex-direction: row;
        gap: 8px;
    }

    .nav-brand img {
        height: 24px;
    }

    .nav-center {
        order: 2;
        width: auto;
        flex: 1;
        margin-top: 0;
        margin-left: 12px;
        margin-right: 12px;
    }

    .language-selector {
        width: auto;
        max-width: 200px;
        font-size: 12px;
        padding: 6px 12px;
        padding-right: 32px;
    }

    .nav-buttons {
        order: 3;
        width: auto;
    }

    .btn {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 32px;
    }

    .simple-editor {
        font-size: 14px;
        padding: 12px;
        min-height: calc(100vh - 70px);
    }

    .syntax-overlay,
    .syntax-highlight {
        font-size: 14px;
        padding: 12px;
        min-height: calc(100vh - 70px);
    }

    .editor-wrapper,
    .simple-editor-container {
        min-height: calc(100vh - 70px);
    }
}

@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }

    .language-selector {
        min-height: 44px;
        touch-action: manipulation;
    }

    .back-link {
        min-height: 44px;
        touch-action: manipulation;
    }
}

.btn-api {
    background-color: #2c3e50;
}
.btn-api:hover {
    background-color: #34495e;
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.7); 
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #1e1e1e;
    margin: 5% auto; 
    padding: 0;
    border: 1px solid #333;
    width: 80%; 
    max-width: 900px;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #009DE1;
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.api-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 400px;
}

.api-menu {
    width: 200px;
    background-color: #161616;
    border-right: 1px solid #333;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.api-menu-btn {
    background: none;
    border: none;
    color: #aaa;
    padding: 12px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.api-menu-btn:hover {
    background-color: #252525;
    color: #fff;
}

.api-menu-btn.active {
    background-color: #252525;
    color: #009DE1;
    border-left-color: #009DE1;
    font-weight: 600;
}

.api-details {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background-color: #1e1e1e;
}

.api-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.api-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.api-section h3 {
    color: #fff;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.api-section p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 20px;
}

.api-section code {
    background-color: #2d2d2d;
    padding: 2px 6px;
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'Consolas', 'Monaco', monospace;
}

.code-block-wrapper {
    margin-bottom: 25px;
    background-color: #161616;
    border-radius: 4px;
    border: 1px solid #333;
    overflow: hidden;
}

.code-block-wrapper h4, .response-info h4 {
    background-color: #252525;
    padding: 8px 15px;
    margin: 0;
    font-size: 13px;
    color: #aaa;
    border-bottom: 1px solid #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-block-wrapper pre, .response-info pre {
    margin: 0;
    padding: 15px;
    overflow-x: auto;
    background-color: #161616;
}

.code-block-wrapper pre code, .response-info pre code {
    background: none;
    padding: 0;
    color: #a5d6ff;
}

.response-info {
    margin-top: 30px;
    background-color: #1a2633;
    border: 1px solid #1F5F9F;
    border-radius: 4px;
    overflow: hidden;
}

.response-info h4 {
    background-color: rgba(31, 95, 159, 0.2);
    border-bottom: 1px solid #1F5F9F;
    color: #009DE1;
}

.response-info p {
    padding: 15px 15px 0 15px;
    margin-bottom: 10px;
    color: #ccc;
}

.api-details::-webkit-scrollbar,
.code-block-wrapper pre::-webkit-scrollbar,
.response-info pre::-webkit-scrollbar,
.api-menu::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.api-details::-webkit-scrollbar-track,
.code-block-wrapper pre::-webkit-scrollbar-track,
.response-info pre::-webkit-scrollbar-track,
.api-menu::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.api-details::-webkit-scrollbar-thumb,
.code-block-wrapper pre::-webkit-scrollbar-thumb,
.response-info pre::-webkit-scrollbar-thumb,
.api-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #1F5F9F, #009DE1);
    border-radius: 3px;
    border: 1px solid #009DE1;
}

.api-details::-webkit-scrollbar-thumb:hover,
.code-block-wrapper pre::-webkit-scrollbar-thumb:hover,
.response-info pre::-webkit-scrollbar-thumb:hover,
.api-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #357ABD, #2AC7FF);
}


@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 96vh;
    }

    .api-container {
        flex-direction: column;
    }

    .api-menu {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #333;
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
        background-color: #1a1a1a;
    }

    .api-menu-btn {
        flex: 0 0 auto;
        text-align: center;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        padding: 15px 20px;
    }

    .api-menu-btn.active {
        border-left-color: transparent;
        border-bottom-color: #009DE1;
        background-color: #252525;
    }

    .api-details {
        padding: 15px;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .code-block-wrapper pre, .response-info pre {
        padding: 10px;
        font-size: 12px;
    }
    
    .navbar {
        height: auto;
        flex-wrap: wrap;
        padding: 12px;
    }

    .nav-brand {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        position: relative;
        margin-bottom: 15px;
        gap: 0;
    }

    .logo-link {
        display: flex;
        justify-content: center;
    }

    .nav-brand img {
        height: 40px;
    }

    .back-link {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        background-color: rgba(31, 95, 159, 0.15);
        padding: 8px;
        border-radius: 8px;
        min-height: auto;
        align-self: auto;
    }

    .back-link:hover {
        background-color: rgba(31, 95, 159, 0.3);
        transform: translateY(-50%);
    }

    .back-icon {
        width: 20px;
        height: 20px;
        color: #009DE1;
    }

    .back-text {
        display: none;
    }

    .nav-buttons {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: space-between;
    }

    .language-selector {
        width: 100%;
        order: 1;
        margin-bottom: 5px;
        height: 45px;
    }

    .btn {
        flex: 1;
        order: 3;
        font-size: 14px;
        padding: 12px;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 45px;
    }
    
    .btn-api {
        flex-basis: 100%;
        order: 2;
        margin-bottom: 5px;
        background-color: #2c3e50;
    }
}

.code-block-wrapper {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 5px;
    right: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.copy-btn:hover {
    background-color: rgba(0, 157, 225, 0.2);
    color: #009DE1;
    border-color: #009DE1;
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border-color: #2ecc71;
}
