/* Stealth Browse - Notes Power Up (frosted library + sticky notes) */

.notes-toggle-container:not([hidden]):not(.appearance-hidden) {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
}

#notes-toggle-container[hidden],
#notes-toggle-container.appearance-hidden,
.top-bar #notes-toggle-container[hidden],
.top-bar #notes-toggle-container.appearance-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#notes-toggle-btn img {
    width: 14px !important;
    height: 14px !important;
    object-fit: contain;
}

#notes-toggle-btn.is-open {
    color: #a78bfa;
    background: rgba(90, 13, 214, 0.22);
}

.notes-window {
    --panel-fill-alpha: 0.28;
    --frost-tint-alpha: 0.18;
    position: fixed;
    top: 96px;
    right: 72px;
    width: 760px;
    height: 520px;
    min-width: 520px;
    min-height: 360px;
    z-index: 2147483647 !important;
    border-radius: 16px;
    overflow: hidden !important;
    background: rgba(22, 22, 30, var(--panel-fill-alpha, 0.28)) !important;
    background-color: rgba(22, 22, 30, var(--panel-fill-alpha, 0.28)) !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background-clip: padding-box;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: none;
    flex-direction: column;
    isolation: isolate;
    color: #f2f2f6;
    font-family: inherit;
    pointer-events: auto;
    transform: translateZ(0);
    clip-path: inset(0 round 16px);
    -webkit-clip-path: inset(0 round 16px);
}

#notes-window.show,
#notes-window.page-frost-host {
    overflow: hidden !important;
    border-radius: 16px !important;
    clip-path: inset(0 round 16px) !important;
    -webkit-clip-path: inset(0 round 16px) !important;
}

#notes-window .page-frost-layer,
#notes-window .page-frost-image,
#notes-window .page-frost-layer::after {
    border-radius: 16px !important;
    clip-path: inset(0 round 16px) !important;
    -webkit-clip-path: inset(0 round 16px) !important;
    overflow: hidden !important;
}

.notes-window.show {
    display: flex;
}

.notes-glass-sheen {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 42%),
        radial-gradient(ellipse at 20% 0%, rgba(90, 13, 214, 0.18), transparent 55%);
    opacity: 0.9;
}

[data-theme="stealth-glass"] .notes-glass-sheen,
[data-theme="stealth-float"] .notes-glass-sheen {
    display: none !important;
}

.notes-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    min-height: 28px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.notes-header:active {
    cursor: grabbing;
}

.notes-header-icon {
    width: 16px;
    height: 16px;
    opacity: 0.92;
    flex-shrink: 0;
}

.notes-header-title {
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.01em;
    flex: 1;
    min-width: 0;
}

.notes-header-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.notes-icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    border-radius: var(--stealth-cut, 12px 2px 2px 2px);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.notes-icon-btn:hover {
    background: rgba(90, 13, 214, 0.22);
    border-color: rgba(90, 13, 214, 0.35);
}

.notes-body {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.notes-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.notes-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.notes-sidebar-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.notes-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.notes-sidebar-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: rgba(242, 242, 246, 0.88);
}

.notes-sidebar-option input[type="checkbox"] {
    accent-color: #5a0dd6;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.notes-search {
    width: calc(100% - 20px);
    box-sizing: border-box;
    margin: 8px 10px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--stealth-cut, 12px 2px 2px 2px);
    background: rgba(0, 0, 0, 0.22);
    color: inherit;
    font-size: 12px;
    outline: none;
    flex-shrink: 0;
}

.notes-search:focus {
    border-color: rgba(90, 13, 214, 0.7);
    box-shadow: 0 0 0 2px rgba(90, 13, 214, 0.25);
}

.notes-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 10px 10px;
    flex-shrink: 0;
}

.notes-filter-btn,
.notes-action-btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
}

.notes-filter-btn.is-active,
.notes-action-btn.primary {
    background: linear-gradient(135deg, #5a0dd6, #4900c2);
    border-color: rgba(167, 139, 250, 0.45);
    color: #fff;
}

.notes-filter-btn:hover,
.notes-action-btn:hover {
    border-color: rgba(90, 13, 214, 0.5);
    background: rgba(90, 13, 214, 0.18);
}

.notes-action-btn.primary:hover {
    background: linear-gradient(135deg, #6b1ef0, #5600db);
}

.notes-list {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 8px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(157, 78, 221, 0.55) rgba(255, 255, 255, 0.04);
}

.notes-list::-webkit-scrollbar,
.notes-body-input::-webkit-scrollbar,
.notes-sticky-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.notes-list::-webkit-scrollbar-track,
.notes-body-input::-webkit-scrollbar-track,
.notes-sticky-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.notes-list::-webkit-scrollbar-thumb,
.notes-body-input::-webkit-scrollbar-thumb,
.notes-sticky-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(107, 30, 240, 0.85), rgba(73, 0, 194, 0.9));
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.notes-list::-webkit-scrollbar-thumb:hover,
.notes-body-input::-webkit-scrollbar-thumb:hover,
.notes-sticky-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(130, 60, 255, 0.95), rgba(90, 13, 214, 1));
    background-clip: padding-box;
}

.notes-list::-webkit-scrollbar-corner,
.notes-body-input::-webkit-scrollbar-corner,
.notes-sticky-body::-webkit-scrollbar-corner {
    background: transparent;
}

.notes-list-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 3px;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    margin: 0 0 4px 0;
    border: 1px solid transparent;
    border-radius: var(--stealth-cut-panel, 22px 4px 4px 4px);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    color: #f2f2f6 !important;
    font: inherit;
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
    transform: none;
}

.notes-list-item:hover {
    background: rgba(90, 13, 214, 0.14);
    color: #f2f2f6 !important;
}

.notes-list-item.is-selected {
    background: rgba(90, 13, 214, 0.24);
    border-color: rgba(90, 13, 214, 0.45);
    color: #ffffff !important;
}

.notes-list-item-title {
    display: block;
    width: 100%;
    color: inherit !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.3;
    letter-spacing: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-list-item-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    color: rgba(242, 242, 246, 0.68) !important;
    font-size: 10.5px !important;
    font-weight: 400 !important;
    line-height: 1.25;
    text-align: left;
    opacity: 1;
}

.notes-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.notes-empty {
    padding: 28px 16px;
    text-align: center;
    opacity: 0.7;
    font-size: 12.5px;
    line-height: 1.45;
}

.notes-editor {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    height: 100%;
}

.notes-editor[hidden],
.notes-editor-empty[hidden] {
    display: none !important;
}

.notes-editor-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    opacity: 0.7;
    font-size: 13px;
    min-height: 0;
}

.notes-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.notes-title-input {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 14px 4px;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 18px;
    font-weight: 700;
    outline: none;
    flex-shrink: 0;
}

.notes-body-input {
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 8px 14px 14px;
    border: none;
    resize: none;
    background: transparent;
    color: inherit;
    font-size: 13.5px;
    line-height: 1.55;
    outline: none;
    font-family: inherit;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(157, 78, 221, 0.55) rgba(255, 255, 255, 0.04);
}

.notes-editor-meta {
    padding: 0 14px 10px;
    font-size: 11px;
    opacity: 0.62;
}

.notes-color-picker {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.notes-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    cursor: pointer;
    padding: 0;
}

.notes-color-swatch.is-active {
    outline: 2px solid #a78bfa;
    outline-offset: 1px;
}

.notes-color-swatch[data-color="yellow"] { background: #f6d860; }
.notes-color-swatch[data-color="pink"] { background: #f472b6; }
.notes-color-swatch[data-color="green"] { background: #4ade80; }
.notes-color-swatch[data-color="blue"] { background: #60a5fa; }
.notes-color-swatch[data-color="purple"] { background: #a78bfa; }
.notes-color-swatch[data-color="orange"] { background: #fb923c; }

.notes-resize-handle {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 16px;
    height: 16px;
    z-index: 5;
    cursor: nwse-resize;
}

.notes-resize-handle::before {
    content: "";
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(255, 255, 255, 0.35);
    border-bottom: 2px solid rgba(255, 255, 255, 0.35);
}

/* Sticky notes */
.notes-sticky {
    --panel-fill-alpha: 0.42;
    position: fixed;
    width: 240px;
    height: 220px;
    min-width: 180px;
    min-height: 140px;
    z-index: 2147483646;
    border-radius: 16px;
    overflow: hidden !important;
    display: none;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(22, 22, 30, var(--panel-fill-alpha, 0.42)) !important;
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    clip-path: inset(0 round 16px);
    -webkit-clip-path: inset(0 round 16px);
    color: #f2f2f6;
    isolation: isolate;
    transform: translateZ(0);
}

.notes-sticky.show {
    display: flex;
}

.notes-sticky.page-frost-host {
    background: rgba(14, 16, 22, var(--panel-fill-alpha, 0.42)) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.notes-sticky[data-color="yellow"] { --sticky-tint: rgba(246, 216, 96, 0.18); }
.notes-sticky[data-color="pink"] { --sticky-tint: rgba(244, 114, 182, 0.18); }
.notes-sticky[data-color="green"] { --sticky-tint: rgba(74, 222, 128, 0.16); }
.notes-sticky[data-color="blue"] { --sticky-tint: rgba(96, 165, 250, 0.18); }
.notes-sticky[data-color="purple"] { --sticky-tint: rgba(167, 139, 250, 0.2); }
.notes-sticky[data-color="orange"] { --sticky-tint: rgba(251, 146, 60, 0.18); }

.notes-sticky-tint {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: var(--sticky-tint, rgba(167, 139, 250, 0.16));
}

.notes-sticky-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.notes-sticky-header:active {
    cursor: grabbing;
}

.notes-sticky-title {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 12.5px;
    font-weight: 700;
    outline: none;
    cursor: text;
}

.notes-sticky-body {
    position: relative;
    z-index: 2;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    border: none;
    resize: none;
    padding: 8px 10px 18px;
    background: transparent;
    color: inherit;
    font-size: 12.5px;
    line-height: 1.45;
    outline: none;
    font-family: inherit;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(157, 78, 221, 0.55) rgba(255, 255, 255, 0.04);
}

.notes-sticky.minimized {
    height: 38px !important;
    min-height: 38px !important;
}

.notes-sticky.minimized .notes-sticky-body,
.notes-sticky.minimized .notes-sticky-footer,
.notes-sticky.minimized .notes-resize-handle {
    display: none !important;
}

.notes-sticky-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 8px 6px;
    font-size: 10px;
    opacity: 0.75;
}

.notes-sticky-scope {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.18);
    color: inherit;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    font-size: 10px;
    padding: 2px 6px;
    cursor: pointer;
}

[data-theme="light"] .notes-window,
[data-theme="light"] .notes-sticky {
    color: #1a1b22;
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .notes-search,
[data-theme="light"] .notes-filter-btn,
[data-theme="light"] .notes-action-btn,
[data-theme="light"] .notes-sticky-scope {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1b22;
}

[data-theme="light"] .notes-sidebar {
    background: rgba(255, 255, 255, 0.35);
}

[data-theme="light"] .notes-sidebar-option {
    color: rgba(26, 27, 34, 0.88);
}

[data-theme="light"] .notes-list-item,
[data-theme="light"] .notes-list-item:hover {
    color: #1a1b22 !important;
}

[data-theme="light"] .notes-list-item.is-selected {
    color: #1a1b22 !important;
}

[data-theme="light"] .notes-list-item-meta {
    color: rgba(26, 27, 34, 0.62) !important;
}

[data-theme="light"] .notes-list,
[data-theme="light"] .notes-body-input,
[data-theme="light"] .notes-sticky-body {
    scrollbar-color: rgba(90, 13, 214, 0.45) rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .notes-list::-webkit-scrollbar-track,
[data-theme="light"] .notes-body-input::-webkit-scrollbar-track,
[data-theme="light"] .notes-sticky-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .notes-list::-webkit-scrollbar-thumb,
[data-theme="light"] .notes-body-input::-webkit-scrollbar-thumb,
[data-theme="light"] .notes-sticky-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(107, 30, 240, 0.7), rgba(73, 0, 194, 0.8));
    background-clip: padding-box;
}

[data-theme="stealth"] .notes-window,
[data-theme="stealth"] .notes-sticky {
    border-color: rgba(94, 234, 212, 0.2);
}

[data-theme="stealth-glass"] .notes-window,
[data-theme="stealth-float"] .notes-window,
[data-theme="stealth-glass"] .notes-sticky,
[data-theme="stealth-float"] .notes-sticky {
    background: rgba(14, 16, 22, var(--panel-fill-alpha, 0.42)) !important;
    background-color: rgba(14, 16, 22, var(--panel-fill-alpha, 0.42)) !important;
}
