/* ── Notepad App Styles (Dark Mode) ── */
.gos-notepad {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
    color: #eeeeee;
    font-family: var(--font-family-mono);
}

/* Notepad Menu Bar */
.gos-notepad-menubar {
    display: flex;
    background: #2b2b2b;
    border-bottom: 1px solid #3a3a3a;
    font-family: var(--font-family, 'Segoe UI', system-ui, sans-serif);
    font-size: 0.82rem;
    padding: 1px 2px;
}

.gos-notepad-menu-item {
    padding: 3px 10px;
    cursor: pointer;
    position: relative;
    color: #ccc;
    transition: background 0.1s;
}

.gos-notepad-menu-item:hover,
.gos-notepad-menu-item.active {
    background: #3f3f3f;
    color: #fff;
}

/* Notepad Editor Wrapper */
.gos-notepad-editor {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #1e1e1e;
}

.gos-notepad-content-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: #1e1e1e;
    --np-pad-x: 6px;
}

/* Notepad Gutter (Line Numbers) */
.gos-notepad-gutter {
    width: 45px;
    background: #252525;
    color: #858585;
    padding: 0 5px;
    text-align: right;
    font-size: 0.95rem;
    line-height: 20px;
    user-select: none;
    border-right: 1px solid #333;
    overflow: hidden;
    white-space: pre;
    font-family: var(--font-family-mono);
}

/* Notepad Content */
.gos-notepad-content {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 0 var(--np-pad-x);
    resize: none;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 20px;
    white-space: pre;
    overflow: auto;
    background: transparent;
    color: #eee;
    font-family: var(--font-family-mono);
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    letter-spacing: 0;
    tab-size: 4;
    -moz-tab-size: 4;
    position: relative;
    z-index: 3;
    margin: 0;
}

.gos-notepad-line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: 1;
    display: none;
}

.gos-notepad-content.syntax-active:not(:focus-within) {
    color: transparent;
    caret-color: #eee;
}

.gos-notepad-content.syntax-active:focus {
    /* When focused, we need to be careful. 
       If we have a selection, we want to see the textarea text (for selection to be visible).
       If we don't have a selection, we want it transparent so syntax layer shows through.
       Since CSS can't detect 'has selection', we rely on JS toggling a class or visibility.
    */
    color: transparent;
    caret-color: #eee;
}

/* We will handle the actual 'disappearing' logic in JS by toggling a class when selection exists,
   or simply by making the textarea text visible again when it has a selection. */
.gos-notepad-content.syntax-active.has-selection {
    color: #eee !important;
}

.gos-notepad-content::selection {
    background: #444444;
    color: #ffffff;
}

.gos-notepad-content.syntax-active::selection {
    background: #444444;
    color: #ffffff;
}

.gos-notepad-content:hover,
.gos-notepad-content:focus,
.gos-notepad-content:focus-visible,
.gos-notepad-content:active {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    filter: none !important;
}

.gos-notepad-syntax-layer {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0 var(--np-pad-x);
    font-size: 0.95rem;
    font-weight: 400;
    font-family: var(--font-family-mono);
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    letter-spacing: 0;
    line-height: 20px;
    white-space: pre;
    overflow: hidden;
    color: #eee;
    pointer-events: none;
    z-index: 2;
    display: none;
    tab-size: 4;
    -moz-tab-size: 4;
}

.gos-notepad-syntax-layer.active {
    display: block;
}

.gos-notepad .gos-syn-kw { color: #ffd75f; }
.gos-notepad .gos-syn-op { color: #7ec8ff; }
.gos-notepad .gos-syn-num { color: #8bf18b; }
.gos-notepad .gos-syn-str { color: #ffb6a6; }
.gos-notepad .gos-syn-com { color: #9aa0a8; }
.gos-notepad .gos-syn-varref { color: #ffeaa5; }
.gos-notepad .gos-syn-tag { color: #9ecbff; }

/* Notepad Dropdown (matching system menu) */
.gos-notepad-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0;
    background: #2b2b2b;
    border: 1px solid #444;
    box-shadow: var(--menu-shadow);
    z-index: 1000;
    display: none;
    min-width: 180px;
    padding: 2px;
    font-family: var(--font-family);
}

.gos-notepad-menu-item.active .gos-notepad-dropdown {
    display: block;
}

.gos-notepad-dropdown-item {
    padding: 6px 20px;
    white-space: nowrap;
    color: #eee;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gos-notepad-dropdown-item:hover {
    background: #3f3f3f;
    color: #fff;
}

.gos-notepad-dropdown-item .shortcut {
    color: #888;
    font-size: 0.75rem;
    margin-left: 20px;
}

.gos-notepad-dropdown-sep {
    height: 1px;
    background: #444;
    margin: 2px 4px;
}
