/* ==========================================================================
   code-editor.css — Authentic Code Editor styling for Git & Gist systems
   ========================================================================== */

.uc-code-editor {
    display: flex;
    flex-direction: column;
    background: #080d1a;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    margin-bottom: 24px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.uc-code-editor:focus-within,
.uc-code-editor.is-focused {
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12), 0 20px 50px rgba(0, 0, 0, 0.55);
}

/* Fullscreen Mode */
.uc-code-editor.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
    box-shadow: none !important;
    border: none !important;
}

.uc-code-editor.is-fullscreen .uc-editor-surface {
    flex: 1 1 auto !important;
    height: calc(100vh - 72px) !important;
    max-height: none !important;
}

/* Editor Header Bar */
.uc-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #0d1527;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    padding: 0 14px;
    height: 42px;
    min-height: 42px;
    user-select: none;
    box-sizing: border-box;
}

.uc-editor-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

/* Window controls dots (mac/editor style) */
.uc-editor-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
}

.uc-editor-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.uc-editor-dots .dot-red {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.uc-editor-dots .dot-yellow {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.uc-editor-dots .dot-green {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* Active File Tab */
.uc-editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #080d1a;
    border-top: 2px solid #38bdf8;
    border-left: 1px solid rgba(148, 163, 184, 0.12);
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    border-bottom: 1px solid #080d1a;
    margin-bottom: -1px;
    padding: 8px 14px;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 380px;
}

.uc-file-icon {
    font-size: 13px;
    color: #38bdf8;
}

.uc-file-icon.icon-py { color: #38bdf8; }
.uc-file-icon.icon-js { color: #facc15; }
.uc-file-icon.icon-ts { color: #60a5fa; }
.uc-file-icon.icon-html { color: #fb923c; }
.uc-file-icon.icon-css { color: #38bdf8; }
.uc-file-icon.icon-cs { color: #c084fc; }
.uc-file-icon.icon-rs { color: #fb923c; }
.uc-file-icon.icon-go { color: #22d3ee; }
.uc-file-icon.icon-sh { color: #4ade80; }
.uc-file-icon.icon-json,
.uc-file-icon.icon-yml,
.uc-file-icon.icon-yaml { color: #e879f9; }
.uc-file-icon.icon-md { color: #94a3b8; }

.uc-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uc-dirty-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
    display: inline-block;
    margin-left: 2px;
}

/* Editor Action Controls */
.uc-editor-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.uc-editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.2;
}

.uc-editor-btn:hover {
    color: #fff;
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.3);
}

.uc-editor-btn.is-active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
}

.uc-editor-btn.uc-btn-reset:hover {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.12);
}

.uc-editor-btn:active {
    transform: translateY(1px);
}

.uc-editor-font-size {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #64748b;
    padding: 0 3px;
}

.uc-lang-select {
    background: #080d1a;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #38bdf8;
    outline: none;
    cursor: pointer;
}

.uc-lang-select:focus {
    border-color: #38bdf8;
}

/* Editor Surface & Ace Editor Overrides */
.uc-editor-surface {
    position: relative;
    width: 100%;
    min-height: 280px;
    height: 540px;
    background: #080d1a;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

.uc-editor-surface .uc-code-fallback {
    margin: 0;
    padding: 16px 20px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13.5px;
    line-height: 1.65;
    color: #e2e8f0;
    overflow: auto;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    background: #080d1a;
    border: none;
    display: block;
}

.uc-editor-surface.ace_editor,
.uc-editor-surface .ace_editor {
    background: #080d1a !important;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 13.5px;
    line-height: 1.65;
}

.uc-editor-surface .ace_gutter {
    background: #060913 !important;
    border-right: 1px solid rgba(148, 163, 184, 0.1) !important;
    color: #475569 !important;
    padding-right: 6px !important;
}

.uc-editor-surface .ace_gutter-active-line {
    background: rgba(56, 189, 248, 0.08) !important;
    color: #94a3b8 !important;
    font-weight: 700 !important;
}

.uc-editor-surface .ace_gutter-cell {
    padding-left: 14px !important;
    padding-right: 10px !important;
}

.uc-editor-surface .ace_cursor {
    border-left: 2px solid #38bdf8 !important;
}

.uc-editor-surface .ace_marker-layer .ace_active-line {
    background: rgba(255, 255, 255, 0.032) !important;
}

.uc-editor-surface .ace_marker-layer .ace_selection {
    background: rgba(56, 189, 248, 0.24) !important;
}

.uc-editor-surface .ace_scroller {
    overflow-x: auto !important;
}

.uc-editor-surface .ace_scrollbar-v,
.uc-editor-surface .ace_scrollbar-h {
    z-index: 5 !important;
}

/* Status Bar */
.uc-editor-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 28px;
    min-height: 28px;
    padding: 0 14px;
    background: #070d18;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #94a3b8;
    user-select: none;
    box-sizing: border-box;
}

.uc-editor-statusbar .statusbar-left,
.uc-editor-statusbar .statusbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.uc-editor-statusbar .status-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.uc-editor-statusbar .status-ready {
    color: #22c55e;
}

.uc-editor-statusbar .status-modified {
    color: #f59e0b;
}

.uc-editor-statusbar .status-readonly {
    color: #64748b;
}

.uc-editor-statusbar .badge-lang {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Binary file viewer */
.uc-editor-binary {
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
    background: #080d1a;
}

.uc-editor-binary i {
    font-size: 42px;
    color: #475569;
    margin-bottom: 14px;
    display: block;
}

/* Responsive Rules */
@media (max-width: 768px) {
    .uc-editor-header {
        padding: 0 10px;
        height: auto;
        min-height: 40px;
        flex-wrap: wrap;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .uc-editor-actions .btn-text {
        display: none;
    }

    .uc-editor-dots {
        display: none;
    }

    .uc-editor-tab {
        max-width: 220px;
        padding: 6px 10px;
        font-size: 11.5px;
    }

    .uc-editor-statusbar {
        font-size: 10px;
        padding: 0 8px;
        gap: 8px;
        overflow-x: auto;
    }

    .uc-editor-statusbar .status-item:not(.status-pos):not(.status-lang):not(.status-lines) {
        display: none;
    }

    .uc-editor-surface {
        height: 420px;
    }
}
