.notepad-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
    color: #d4d4d4;
}

/* ── Menu bar ── */
.notepad-menubar {
    display: flex;
    gap: 0;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
}

.notepad-menu-item {
    padding: 5px 12px;
    font-size: 12px;
    color: #bbb;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

.notepad-menu-item:hover {
    background: #3e3e42;
    color: #fff;
}

/* ── Tab bar ── */
.notepad-tabbar {
    display: flex;
    background: #252526;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    scroll-behavior: smooth;
}

.notepad-tabbar.hidden {
    display: none;
}

.notepad-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 12px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    border-right: 1px solid #1b1b1b;
    white-space: nowrap;
    max-width: 200px;
    min-width: 80px;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s, color 0.15s;
}

.notepad-tab::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.15s;
}

.notepad-tab:hover {
    background: #2a2d2e;
    color: #ccc;
}

.notepad-tab.active {
    background: #1e1e1e;
    color: #fff;
}

.notepad-tab.active::after {
    background: #4fc3f7;
}

.notepad-tab-icon {
    font-size: 11px;
    opacity: 0.7;
    flex-shrink: 0;
}

.notepad-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.notepad-tab-modified {
    color: #e8e8e8;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: -2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.notepad-tab.modified .notepad-tab-modified {
    opacity: 1;
}

.notepad-tab-close {
    font-size: 14px;
    color: #666;
    line-height: 1;
    border-radius: 3px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.1s, color 0.1s;
}

.notepad-tab:hover .notepad-tab-close,
.notepad-tab.active .notepad-tab-close {
    opacity: 1;
}

.notepad-tab-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Tab overflow chevrons */
.notepad-tabbar-overflow {
    display: flex;
    align-items: center;
    background: #252526;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
}

.notepad-tab-scroll-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 14px;
    padding: 2px 6px;
    cursor: pointer;
    height: 100%;
    display: none;
    align-items: center;
}

.notepad-tab-scroll-btn:hover {
    background: #3e3e42;
    color: #fff;
}

.notepad-tab-scroll-btn.visible {
    display: flex;
}

/* ── Find bar ── */
.notepad-find-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: notepad-find-slide 0.15s ease-out;
}

@keyframes notepad-find-slide {
    from { opacity: 0; transform: translateY(-100%); }
    to   { opacity: 1; transform: translateY(0); }
}

.notepad-find-bar.hidden {
    display: none;
}

.notepad-find-bar input {
    background: #3c3c3c;
    border: 1px solid #555;
    border-radius: 3px;
    color: #d4d4d4;
    padding: 4px 8px;
    font-size: 12px;
    font-family: "Cascadia Code", "Fira Code", "Consolas", "Courier New", monospace;
    outline: none;
    width: 160px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.notepad-find-bar input:focus {
    border-color: #4fc3f7;
    box-shadow: 0 0 0 1px rgba(79, 195, 247, 0.25);
}

.notepad-find-bar input.no-match {
    border-color: #f44747;
    background: rgba(244, 71, 71, 0.12);
}

.notepad-find-btn {
    background: transparent;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ccc;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

.notepad-find-btn:hover {
    background: #3e3e42;
    color: #fff;
}

.notepad-find-btn:active {
    background: #4fc3f7;
    color: #000;
}

.notepad-find-count {
    font-size: 11px;
    color: #888;
    min-width: 70px;
    font-variant-numeric: tabular-nums;
}

.notepad-find-count.no-match {
    color: #f44747;
}

.notepad-find-sep {
    width: 1px;
    height: 20px;
    background: #444;
    margin: 0 2px;
    flex-shrink: 0;
}

.notepad-find-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: auto;
    border-radius: 3px;
    transition: background 0.1s, color 0.1s;
}

.notepad-find-close:hover {
    background: #3e3e42;
    color: #fff;
}

/* ── Editor area ── */
.notepad-editor-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.notepad-gutter {
    width: 50px;
    padding: 10px 10px 10px 0;
    background: #1e1e1e;
    color: #4e4e4e;
    font-family: "Cascadia Code", "Fira Code", "Consolas", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    text-align: right;
    overflow: hidden;
    white-space: pre;
    flex-shrink: 0;
    border-right: 1px solid #2d2d2d;
    user-select: none;
    -webkit-user-select: none;
}

/* Active line highlight in gutter */
.notepad-gutter-line {
    display: block;
    height: 1.5em;
    padding-right: 2px;
}

.notepad-gutter-line.active {
    color: #c6c6c6;
    background: rgba(255, 255, 255, 0.04);
}

.notepad-editor {
    flex: 1;
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    outline: none;
    padding: 10px 14px;
    font-family: "Cascadia Code", "Fira Code", "Consolas", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    resize: none;
    overflow-y: auto;
    overflow-x: hidden;
    tab-size: 4;
    caret-color: #4fc3f7;
}

.notepad-editor::selection {
    background: rgba(79, 195, 247, 0.3);
}

/* Current line background — rendered via overlay */
.notepad-current-line {
    position: absolute;
    left: 51px; /* gutter width + 1px border */
    right: 0;
    height: 1.5em;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
    transition: top 0.05s;
    z-index: 0;
}

/* ── Minimap (scroll indicator) ── */
.notepad-minimap {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 2;
}

.notepad-minimap-thumb {
    position: absolute;
    right: 0;
    width: 6px;
    background: rgba(79, 195, 247, 0.35);
    border-radius: 3px;
    min-height: 12px;
    transition: opacity 0.3s;
    opacity: 0;
}

.notepad-editor-wrap:hover .notepad-minimap-thumb {
    opacity: 1;
}

/* ── Status bar ── */
.notepad-statusbar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    background: #007acc;
    color: #fff;
    font-size: 11px;
    flex-shrink: 0;
    height: 22px;
    overflow: hidden;
}

.notepad-statusbar span {
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    transition: background 0.15s;
}

.notepad-statusbar span:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notepad-statusbar span:last-child {
    margin-left: auto;
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.notepad-statusbar .notepad-status-shortcuts {
    opacity: 0.65;
    font-size: 10px;
    border-right: none;
}

.notepad-statusbar .notepad-status-shortcuts:hover {
    opacity: 1;
}

/* Word count animation */
@keyframes notepad-status-flash {
    0%   { background: rgba(255, 255, 255, 0.2); }
    100% { background: transparent; }
}

.notepad-statusbar span.flash {
    animation: notepad-status-flash 0.4s ease-out;
}

/* ── Scrollbar ── */
.notepad-editor::-webkit-scrollbar {
    width: 10px;
}

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

.notepad-editor::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 5px;
    border: 2px solid #1e1e1e;
}

.notepad-editor::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.notepad-tabbar::-webkit-scrollbar {
    height: 3px;
}

.notepad-tabbar::-webkit-scrollbar-track {
    background: #252526;
}

.notepad-tabbar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}

/* ── Empty state ── */
.notepad-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #444;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.notepad-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notepad-empty-state .empty-text {
    font-size: 13px;
    line-height: 1.8;
}

.notepad-empty-state .empty-hint {
    font-size: 11px;
    color: #383838;
    margin-top: 8px;
}
