/* ── RemoteXplorer — Remote File Browser ── */

.remotebrowser-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1c1c1e;
    color: #ddd;
    font-size: 12px;
    font-family: "Segoe UI", system-ui, sans-serif;
}

/* ── Toolbar ── */

.remotebrowser-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #2c2c2e;
    border-bottom: 1px solid #3a3a3c;
    flex-shrink: 0;
}

.remotebrowser-title {
    font-size: 13px;
    font-weight: 600;
    color: #4fc3f7;
    margin-right: 6px;
    white-space: nowrap;
}

.remotebrowser-conn-indicator {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #555;
    margin-right: 4px;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}

.remotebrowser-conn-indicator.connected {
    background: #3fb950;
    box-shadow: 0 0 4px #3fb95088;
}

.remotebrowser-conn-indicator.connecting {
    background: #d29922;
    box-shadow: 0 0 4px #d2992288;
    animation: rb-pulse 0.8s ease-in-out infinite;
}

@keyframes rb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.remotebrowser-addr-bar {
    flex: 1;
    background: #1c1c1e;
    border: 1px solid #3a3a3c;
    color: #ddd;
    font-size: 11px;
    font-family: "Cascadia Code", monospace;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s;
}

.remotebrowser-addr-bar:focus { border-color: #4fc3f7; }

.remotebrowser-toolbar-btn {
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
    color: #ddd;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
}

.remotebrowser-toolbar-btn:hover { background: #3a3a3c; }
.remotebrowser-toolbar-btn:disabled { opacity: 0.4; cursor: default; }
.remotebrowser-toolbar-btn:disabled:hover { background: #2c2c2e; }
.remotebrowser-toolbar-btn.danger { color: #f85149; border-color: #f85149; }
.remotebrowser-toolbar-btn.danger:hover { background: #2a1a1a; }

/* ── Body layout ── */

.remotebrowser-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ── */

.remotebrowser-sidebar {
    width: 180px;
    flex-shrink: 0;
    border-right: 1px solid #3a3a3c;
    overflow-y: auto;
    background: #232325;
}

.remotebrowser-sidebar-header {
    padding: 8px 10px;
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #3a3a3c;
}

.remotebrowser-node-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    border-bottom: 1px solid #2a2a2c;
    border-left: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
}

.remotebrowser-node-item:hover { background: #2e2e30; }
.remotebrowser-node-item.active {
    background: #1a2a3a;
    border-left-color: #4fc3f7;
}

.remotebrowser-node-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3fb950;
    flex-shrink: 0;
    box-shadow: 0 0 3px #3fb95066;
}

.remotebrowser-node-status.backdoored {
    background: #d29922;
    box-shadow: 0 0 3px #d2992266;
}

.remotebrowser-node-info { min-width: 0; flex: 1; }
.remotebrowser-node-name {
    font-size: 11px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.remotebrowser-node-ip {
    font-size: 9px;
    color: #666;
    font-family: "Cascadia Code", monospace;
}

.remotebrowser-node-badges {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.remotebrowser-badge {
    font-size: 7px;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.remotebrowser-badge.root { background: #d29922; color: #000; }
.remotebrowser-badge.bd { background: #30363d; color: #8b949e; }

/* ── Main area ── */

.remotebrowser-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Breadcrumb path bar ── */

.remotebrowser-path-bar {
    padding: 5px 10px;
    background: #2c2c2e;
    border-bottom: 1px solid #3a3a3c;
    font-size: 11px;
    font-family: "Cascadia Code", monospace;
    color: #888;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    white-space: nowrap;
}

.remotebrowser-path-bar::-webkit-scrollbar { height: 2px; }
.remotebrowser-path-bar::-webkit-scrollbar-thumb { background: #3a3a3c; }

.remotebrowser-crumb {
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
    color: #888;
}

.remotebrowser-crumb:hover { background: #3a3a3c; color: #ddd; }
.remotebrowser-crumb.crumb-ip { color: #4fc3f7; }
.remotebrowser-crumb.crumb-ip:hover { color: #7fd8ff; }
.remotebrowser-crumb.crumb-current { color: #ddd; cursor: default; }
.remotebrowser-crumb.crumb-current:hover { background: transparent; }
.remotebrowser-crumb-sep { color: #444; margin: 0 1px; user-select: none; }

/* ── File area ── */

.remotebrowser-file-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.remotebrowser-file-area::-webkit-scrollbar { width: 6px; }
.remotebrowser-file-area::-webkit-scrollbar-thumb { background: #3a3a3c; border-radius: 3px; }

.remotebrowser-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}

.remotebrowser-file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
    text-align: center;
    position: relative;
}

.remotebrowser-file-item:hover { background: #2c2c2e; border-color: #3a3a3c; }
.remotebrowser-file-item:active { transform: scale(0.97); }
.remotebrowser-file-item.selected {
    background: #1a2a3a;
    border-color: #4fc3f7;
    box-shadow: 0 0 0 1px #4fc3f722;
}

.remotebrowser-file-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 6px;
    color: #aaa;
    position: relative;
}

.remotebrowser-file-icon.icon-dir {
    background: #2a3a2a;
    color: #d29922;
    font-size: 18px;
}
.remotebrowser-file-icon.icon-data {
    background: #1a2a3a;
    color: #4fc3f7;
}
.remotebrowser-file-icon.icon-evidence {
    background: #2a1a2a;
    color: #f0883e;
}
.remotebrowser-file-icon.icon-credentials {
    background: #2a2a1a;
    color: #e5534b;
}
.remotebrowser-file-icon.icon-config {
    background: #2a2a30;
    color: #8b949e;
}
.remotebrowser-file-icon.icon-personal {
    background: #2a2030;
    color: #bc8cff;
}
.remotebrowser-file-icon.icon-financial {
    background: #1a2a1a;
    color: #3fb950;
}
.remotebrowser-file-icon.icon-file {
    background: #2a2a2e;
    color: #8b949e;
}

.remotebrowser-file-name {
    font-size: 10px;
    color: #ccc;
    word-break: break-all;
    line-height: 1.3;
    max-width: 80px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.remotebrowser-file-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    font-family: "Cascadia Code", monospace;
}

.remotebrowser-file-value {
    color: #3fb950;
}

.remotebrowser-file-size {
    color: #555;
}

/* ── Preview panel ── */

.remotebrowser-preview {
    width: 260px;
    flex-shrink: 0;
    border-left: 1px solid #3a3a3c;
    display: flex;
    flex-direction: column;
    background: #1a1a1c;
    animation: rb-slide-in 0.2s ease-out;
}

@keyframes rb-slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.remotebrowser-preview-header {
    padding: 8px 10px;
    background: #2c2c2e;
    border-bottom: 1px solid #3a3a3c;
    font-size: 11px;
    font-weight: 600;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.remotebrowser-preview-type-badge {
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.remotebrowser-preview-type-badge.type-data { background: #1a2a3a; color: #4fc3f7; }
.remotebrowser-preview-type-badge.type-evidence { background: #2a1a1a; color: #f0883e; }
.remotebrowser-preview-type-badge.type-credentials { background: #2a1a1a; color: #e5534b; }
.remotebrowser-preview-type-badge.type-config { background: #2a2a30; color: #8b949e; }
.remotebrowser-preview-type-badge.type-personal { background: #2a2030; color: #bc8cff; }
.remotebrowser-preview-type-badge.type-financial { background: #1a2a1a; color: #3fb950; }
.remotebrowser-preview-type-badge.type-file { background: #2a2a2e; color: #8b949e; }

.remotebrowser-preview-meta {
    padding: 8px 10px;
    border-bottom: 1px solid #3a3a3c;
    font-size: 11px;
    color: #888;
}

.remotebrowser-preview-meta div { margin-bottom: 3px; }
.remotebrowser-preview-meta span { color: #ccc; }

.remotebrowser-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    font-size: 11px;
    font-family: "Cascadia Code", monospace;
    color: #aaa;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.remotebrowser-preview-content::-webkit-scrollbar { width: 4px; }
.remotebrowser-preview-content::-webkit-scrollbar-thumb { background: #3a3a3c; border-radius: 2px; }

.remotebrowser-preview-actions {
    padding: 8px;
    border-top: 1px solid #3a3a3c;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.remotebrowser-action-btn {
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
    color: #cdd;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.remotebrowser-action-btn:hover { background: #3a3a3c; }
.remotebrowser-action-btn:active { transform: scale(0.97); }
.remotebrowser-action-btn.primary { border-color: #3fb950; color: #3fb950; }
.remotebrowser-action-btn.primary:hover { background: #1a2a1a; }
.remotebrowser-action-btn:disabled { opacity: 0.4; cursor: default; }
.remotebrowser-action-btn:disabled:hover { background: #2c2c2e; transform: none; }

/* Download progress bar overlay */
.remotebrowser-action-btn .rb-dl-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    background: #3fb950;
    width: 0%;
    transition: width 0.15s linear;
}

/* ── Status bar ── */

.remotebrowser-status-bar {
    padding: 3px 10px;
    background: #2c2c2e;
    border-top: 1px solid #3a3a3c;
    font-size: 10px;
    color: #666;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remotebrowser-status-bar .status-ok { color: #3fb950; }
.remotebrowser-status-bar .status-alert { color: #f85149; }

.remotebrowser-status-bar .rb-item-count {
    color: #555;
    margin-left: auto;
    padding-left: 10px;
}

/* ── Not connected / empty states ── */

.remotebrowser-not-connected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #555;
    gap: 8px;
}

.remotebrowser-not-connected-icon {
    font-size: 40px;
    opacity: 0.6;
    animation: rb-float 3s ease-in-out infinite;
}

@keyframes rb-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.remotebrowser-not-connected-text { font-size: 13px; }
.remotebrowser-not-connected-hint { font-size: 11px; color: #444; }

.remotebrowser-empty-dir {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #444;
    gap: 4px;
    font-size: 11px;
}

/* ── Loading skeleton ── */

.remotebrowser-loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}

.remotebrowser-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px 8px;
    border-radius: 6px;
}

.remotebrowser-skeleton-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: linear-gradient(90deg, #2a2a2e 25%, #333338 50%, #2a2a2e 75%);
    background-size: 200% 100%;
    animation: rb-shimmer 1.2s infinite;
}

.remotebrowser-skeleton-text {
    width: 52px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #2a2a2e 25%, #333338 50%, #2a2a2e 75%);
    background-size: 200% 100%;
    animation: rb-shimmer 1.2s infinite;
}

@keyframes rb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Connecting animation overlay ── */

.remotebrowser-connecting {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: #4fc3f7;
}

.remotebrowser-connecting-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid #3a3a3c;
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: rb-spin 0.7s linear infinite;
}

@keyframes rb-spin {
    to { transform: rotate(360deg); }
}

.remotebrowser-connecting-text {
    font-size: 11px;
    font-family: "Cascadia Code", monospace;
    color: #888;
}

.remotebrowser-connecting-text::after {
    content: "";
    animation: rb-dots 1.2s steps(4, end) infinite;
}

@keyframes rb-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}
