/* Stealth Browse - Offline Page Power Up */

.offline-page-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;
}

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

#offline-page-toggle-btn img,
.top-bar #offline-page-toggle-btn img {
    width: 11px !important;
    height: 11px !important;
    max-width: 11px !important;
    max-height: 11px !important;
    display: block !important;
    object-fit: contain !important;
}

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

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

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

#offline-pages-window .page-frost-layer,
#offline-pages-window .page-frost-image,
#offline-pages-window .page-frost-layer::after {
    border-radius: 16px !important;
}

.offline-pages-window.show {
    display: flex;
}

.offline-pages-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%);
}

.offline-pages-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;
}

.offline-pages-header:active { cursor: grabbing; }

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

.offline-pages-header-title {
    font-size: 13px;
    font-weight: 650;
    flex: 1;
    min-width: 0;
}

.offline-pages-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: 14px;
    line-height: 1;
    padding: 0;
}

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

.offline-pages-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

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

.offline-pages-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;
}

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

.offline-pages-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;
}

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

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

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

.offline-pages-action-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.offline-pages-status {
    padding: 0 12px 8px;
    font-size: 11px;
    opacity: 0.75;
    flex-shrink: 0;
    min-height: 16px;
}

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

.offline-pages-list::-webkit-scrollbar { width: 10px; }
.offline-pages-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}
.offline-pages-list::-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;
}

.offline-pages-empty {
    padding: 36px 18px;
    text-align: center;
    opacity: 0.7;
    font-size: 12.5px;
    line-height: 1.45;
}

.offline-pages-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    margin: 0 0 4px 0;
    border: 1px solid transparent;
    border-radius: var(--stealth-cut-panel, 22px 4px 4px 4px);
    background: rgba(255, 255, 255, 0.03);
    color: #f2f2f6 !important;
    font: inherit;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transform: none;
}

.offline-pages-item:hover {
    background: rgba(90, 13, 214, 0.14);
}

.offline-pages-item.is-selected {
    background: rgba(90, 13, 214, 0.24);
    border-color: rgba(90, 13, 214, 0.45);
}

.offline-pages-item-title {
    font-size: 12px;
    font-weight: 600;
    color: inherit !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.offline-pages-item-meta {
    font-size: 10.5px;
    color: rgba(242, 242, 246, 0.68) !important;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.offline-pages-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.offline-pages-item-actions .offline-pages-action-btn {
    padding: 4px 7px;
}

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

.offline-pages-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);
}

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

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

[data-theme="light"] .offline-pages-item,
[data-theme="light"] .offline-pages-item:hover,
[data-theme="light"] .offline-pages-item.is-selected {
    color: #1a1b22 !important;
}

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