/* Filefy - Surveillance Operations Theme CSS */

/* Variables */
:root {
    --bg-primary: #020608;
    --bg-secondary: #071115;
    --bg-tertiary: #0d1d22;
    --bg-hover: #123139;
    --bg-active: rgba(0, 255, 170, 0.16);
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --border-color: #164b52;
    --border-light: #0d3037;
    
    --accent-primary: #00ffc6;
    --accent-secondary: #00a884;
    --accent-success: #35ff6b;
    --accent-warning: #f6d743;
    --accent-danger: #ff3b5f;
    --accent-purple: #9d7cff;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.2s ease;
    
    --header-height: 60px;
    --sidebar-width: 280px;
    --details-width: 300px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(0, 255, 198, 0.08), transparent 32%),
        linear-gradient(135deg, #020608 0%, #071115 55%, #03090c 100%);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    background: var(--bg-hover);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: #001512;
    box-shadow: 0 0 14px rgba(0, 255, 198, 0.18);
}

.btn-primary:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.btn-danger {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    color: white;
}

.btn-danger:hover {
    background: #da3633;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.logo i {
    font-size: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--bg-active);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* Main Container */
.main-container {
    display: flex;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.ops-console {
    padding: 14px;
    background:
        linear-gradient(135deg, rgba(0, 255, 198, 0.08), transparent 55%),
        var(--bg-tertiary);
    border: 1px solid rgba(0, 255, 198, 0.18);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 18px rgba(0, 255, 198, 0.04);
}

.ops-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ops-row strong {
    color: var(--accent-primary);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 12px;
}

.ops-path {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ops-clock {
    margin-top: 8px;
    color: var(--accent-success);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 12px;
    letter-spacing: 1px;
}

.quick-links {
    list-style: none;
}

.quick-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.quick-links li:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.quick-links li i {
    width: 20px;
    text-align: center;
    color: var(--accent-primary);
}

/* Disk Usage */
.disk-usage {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.disk-progress {
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.disk-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-success), var(--accent-primary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.disk-info {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Download List */
.download-list {
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.download-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
}

.download-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.download-filename {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.download-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.download-status.pending {
    background: var(--accent-warning);
    color: #000;
}

.download-status.downloading {
    background: var(--accent-primary);
    color: #000;
}

.download-status.completed {
    background: var(--accent-success);
    color: #000;
}

.download-status.error {
    background: var(--accent-danger);
    color: #fff;
}

.download-status.cancelled,
.download-status.cancelling {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.download-progress {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.download-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.download-info {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.download-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.download-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
}

.download-error,
.download-cancelled {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.download-error {
    color: var(--accent-danger);
    background: rgba(255, 59, 95, 0.12);
}

.download-cancelled {
    color: var(--text-secondary);
    background: rgba(139, 148, 158, 0.12);
}

.download-complete {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--accent-success);
    background: rgba(63, 185, 80, 0.1);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.download-item.error {
    border-left: 3px solid var(--accent-danger);
}

.download-item.completed {
    border-left: 3px solid var(--accent-success);
}

.download-item.downloading {
    border-left: 3px solid var(--accent-primary);
}

.download-item.pending {
    border-left: 3px solid var(--accent-warning);
}

.download-item.cancelled,
.download-item.cancelling {
    border-left: 3px solid var(--text-muted);
}

/* Main Content */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    overflow-x: auto;
    max-width: 60%;
}

.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.breadcrumb-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 2px;
}

.view-toggle .btn {
    border: none;
    background: transparent;
}

.view-toggle .btn.active {
    background: var(--bg-hover);
}

/* File Container */
.file-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Grid View */
.file-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.file-list.grid-view .file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.file-list.grid-view .file-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.file-list.grid-view .file-item.selected {
    background: var(--bg-active);
    border-color: var(--accent-primary);
}

.file-list.grid-view .file-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.file-list.grid-view .file-name {
    font-size: 13px;
    text-align: center;
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* List View */
.file-list.list-view {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-list.list-view .file-item {
    display: grid;
    grid-template-columns: 40px 1fr 120px 160px 80px;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.file-list.list-view .file-item:hover {
    background: var(--bg-tertiary);
}

.file-list.list-view .file-item.selected {
    background: var(--bg-active);
    border-color: var(--accent-primary);
}

.file-list.list-view .file-icon {
    font-size: 20px;
}

.file-list.list-view .file-name {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list.list-view .file-size,
.file-list.list-view .file-modified,
.file-list.list-view .file-perms {
    font-size: 13px;
    color: var(--text-secondary);
}

/* File Icons Colors */
.file-icon.fa-folder { color: #f9c74f; }
.file-icon.fa-file-code { color: #90be6d; }
.file-icon.fa-file-alt { color: #8ecae6; }
.file-icon.fa-file-pdf { color: #f85149; }
.file-icon.fa-file-word { color: #43a5f5; }
.file-icon.fa-file-excel { color: #3fb950; }
.file-icon.fa-file-powerpoint { color: #f48c06; }
.file-icon.fa-file-image { color: #a371f7; }
.file-icon.fa-file-audio { color: #ff006e; }
.file-icon.fa-file-video { color: #8338ec; }
.file-icon.fa-file-archive { color: #ef476f; }
.file-icon.fa-file { color: var(--text-secondary); }

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

/* Details Panel */
.details-panel {
    width: 0;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow: hidden;
    transition: width 0.3s ease;
}

.details-panel.open {
    width: var(--details-width);
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.details-content {
    padding: 16px;
    overflow-y: auto;
    height: calc(100% - 57px);
}

.no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
}

.no-selection i {
    font-size: 48px;
    margin-bottom: 16px;
}

.detail-preview {
    width: 100%;
    height: 150px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    overflow: hidden;
}

.detail-preview i {
    font-size: 64px;
}

.detail-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.detail-info {
    margin-bottom: 16px;
}

.detail-name {
    font-size: 16px;
    font-weight: 600;
    word-break: break-all;
    margin-bottom: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.detail-row .label {
    color: var(--text-muted);
}

.detail-row .value {
    color: var(--text-primary);
    text-align: right;
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Context Menu - Modern Design */
.context-menu {
    position: fixed;
    background: linear-gradient(145deg, var(--bg-secondary), rgba(30, 34, 43, 0.98));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 240px;
    max-width: 280px;
    /* Keep the menu fully visible: never taller than the area below
       the fixed header, with internal scroll if its items don't fit. */
    max-height: calc(100vh - var(--header-height) - 24px);
    overflow-y: auto;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(10px);
    animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.context-menu.show {
    display: block;
}

.context-menu-section {
    padding: 4px 0;
}

.context-menu-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 16px 4px;
    user-select: none;
}

.context-menu-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 2px 12px;
}

.context-menu ul {
    list-style: none;
    padding: 2px 6px;
}

.context-menu li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 450;
    transition: all 0.15s ease;
    position: relative;
    color: var(--text-secondary);
}

.context-menu li i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--accent-primary);
    transition: transform 0.2s ease;
}

.context-menu li:hover {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    color: #000;
    transform: translateX(2px);
}

.context-menu li:hover i {
    color: #000;
    transform: scale(1.1);
}

.context-menu li .shortcut {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
}

.context-menu li:hover .shortcut {
    background: rgba(0, 0, 0, 0.2);
    color: #000;
}

.context-menu li.danger {
    color: var(--accent-danger);
}

.context-menu li.danger i {
    color: var(--accent-danger);
}

.context-menu li.danger:hover {
    background: linear-gradient(90deg, var(--accent-danger), #c94038);
    color: #fff;
}

.context-menu li.danger:hover i {
    color: #fff;
}

.context-menu li#ctxPaste.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-sm {
    max-width: 400px;
}

.modal-content.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--bg-active);
}

.form-help {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    transition: var(--transition);
}

.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: var(--bg-active);
}

.upload-zone i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-zone p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-zone span {
    color: var(--text-muted);
    display: block;
    margin-bottom: 16px;
}

.upload-progress {
    margin-top: 20px;
}

.upload-file-list {
    max-height: 200px;
    overflow-y: auto;
}

.upload-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.upload-file-item i {
    color: var(--accent-primary);
}

.upload-file-item .file-info {
    flex: 1;
}

.upload-file-item .file-name {
    font-size: 13px;
    font-weight: 500;
}

.upload-file-item .file-size {
    font-size: 11px;
    color: var(--text-muted);
}

.upload-file-item .remove-file {
    color: var(--accent-danger);
    cursor: pointer;
}

/* Folder Browser */
.folder-browser {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.folder-path {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-list {
    max-height: 300px;
    overflow-y: auto;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.folder-item:hover {
    background: var(--bg-hover);
}

.folder-item i {
    color: #f9c74f;
}

.folder-item.parent {
    color: var(--text-muted);
}

.folder-item.parent i {
    color: var(--text-muted);
}

/* Preview Content */
.preview-content {
    min-height: 300px;
    max-height: 70vh;
    overflow: auto;
}

.preview-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.preview-content pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* Properties Content */
.properties-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.properties-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.properties-icon i {
    font-size: 64px;
}

.properties-table {
    width: 100%;
    border-collapse: collapse;
}

.properties-table tr {
    border-bottom: 1px solid var(--border-light);
}

.properties-table td {
    padding: 10px 0;
    font-size: 13px;
}

.properties-table td:first-child {
    color: var(--text-muted);
    width: 100px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 3000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--accent-success);
}

.toast.error {
    border-left: 4px solid var(--accent-danger);
}

.toast.warning {
    border-left: 4px solid var(--accent-warning);
}

.toast.info {
    border-left: 4px solid var(--accent-primary);
}

.toast i {
    font-size: 18px;
}

.toast.success i { color: var(--accent-success); }
.toast.error i { color: var(--accent-danger); }
.toast.warning i { color: var(--accent-warning); }
.toast.info i { color: var(--accent-primary); }

.toast-message {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Warning text */
.warning {
    color: var(--accent-danger);
    font-size: 13px;
    margin-top: 8px;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* Responsive */
@media (max-width: 1200px) {
    .details-panel.open {
        width: 260px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 240px;
    }
    
    .search-box {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: var(--header-height);
        height: calc(100% - var(--header-height));
        z-index: 99;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .details-panel {
        position: fixed;
        right: -300px;
        top: var(--header-height);
        height: calc(100% - var(--header-height));
        z-index: 99;
        transition: right 0.3s ease;
    }
    
    .details-panel.open {
        right: 0;
        width: 280px;
    }
    
    .search-box {
        display: none;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .breadcrumb {
        max-width: 100%;
    }
    
    .file-list.list-view .file-item {
        grid-template-columns: 40px 1fr 80px;
    }
    
    .file-list.list-view .file-modified,
    .file-list.list-view .file-perms {
        display: none;
    }
}

/* ===========================================================
   Transfer Center: centered floating panel for uploads + downloads
   =========================================================== */

.transfer-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, calc(100vw - 32px));
    max-height: min(600px, calc(100vh - 80px));
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 1500;
    overflow: hidden;
    animation: transfer-pop 0.2s ease;
}

@keyframes transfer-pop {
    from { opacity: 0; transform: translate(-50%, -45%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.transfer-center.hidden {
    display: none;
}

.transfer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.transfer-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.transfer-title h3 {
    font-size: 15px;
    margin: 0;
}

.transfer-title i {
    color: var(--accent-primary);
}

.transfer-count-badge {
    background: var(--bg-active);
    color: var(--accent-primary);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

.transfer-header-actions {
    display: flex;
    gap: 6px;
}

.transfer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 16px;
}

.transfer-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
}

.transfer-empty i {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.transfer-empty p {
    font-size: 13px;
}

.transfer-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transfer-row {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: var(--transition);
}

.transfer-row.downloading,
.transfer-row.uploading {
    border-left: 3px solid var(--accent-primary);
}

.transfer-row.completed {
    border-left: 3px solid var(--accent-success);
}

.transfer-row.error {
    border-left: 3px solid var(--accent-danger);
}

.transfer-row.cancelled,
.transfer-row.cancelling,
.transfer-row.paused {
    border-left: 3px solid var(--text-muted);
}

.transfer-row-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.transfer-row-name {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.transfer-row-name .filename {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transfer-row-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.transfer-row-status.uploading,
.transfer-row-status.downloading {
    background: var(--bg-active);
    color: var(--accent-primary);
}

.transfer-row-status.completed {
    background: rgba(63, 185, 80, 0.16);
    color: var(--accent-success);
}

.transfer-row-status.error {
    background: rgba(255, 59, 95, 0.16);
    color: var(--accent-danger);
}

.transfer-row-status.cancelled,
.transfer-row-status.cancelling {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.transfer-row-status.paused {
    background: rgba(246, 215, 67, 0.16);
    color: var(--accent-warning);
}

.transfer-row-progress {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.transfer-row-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.2s ease;
}

.transfer-row.error .transfer-row-progress-bar {
    background: var(--accent-danger);
}

.transfer-row.completed .transfer-row-progress-bar {
    background: var(--accent-success);
}

.transfer-row.paused .transfer-row-progress-bar {
    background: var(--accent-warning);
}

.transfer-row-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.transfer-row-info .err-msg {
    color: var(--accent-danger);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transfer-row-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.transfer-row-actions .btn {
    padding: 4px 10px;
    font-size: 11px;
    height: auto;
    width: auto;
}

/* Floating reopen pill shown when the centered panel is minimised. */
.transfer-reopen {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    border-radius: 999px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    z-index: 1400;
    box-shadow: var(--shadow-md);
}

.transfer-reopen.hidden {
    display: none;
}

.transfer-reopen:hover {
    background: var(--bg-hover);
}

/* Sidebar compact transfer view */
.sidebar-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.btn-tiny {
    width: 24px;
    height: 24px;
    padding: 4px;
    font-size: 11px;
}

.sidebar-transfers {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.sidebar-empty {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 10px 0;
}

.sidebar-transfer-row {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 8px;
    border-left: 3px solid var(--accent-primary);
}

.sidebar-transfer-row.completed { border-left-color: var(--accent-success); }
.sidebar-transfer-row.error     { border-left-color: var(--accent-danger);  }
.sidebar-transfer-row.paused    { border-left-color: var(--accent-warning); }
.sidebar-transfer-row.cancelled { border-left-color: var(--text-muted); }

.sidebar-transfer-row .head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.sidebar-transfer-row .name {
    font-size: 12px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.sidebar-transfer-row .pct {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-transfer-row .bar {
    height: 3px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin: 6px 0 6px;
    overflow: hidden;
}

.sidebar-transfer-row .bar > span {
    display: block;
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.2s ease;
}

.sidebar-transfer-row.completed .bar > span { background: var(--accent-success); }
.sidebar-transfer-row.error     .bar > span { background: var(--accent-danger);  }
.sidebar-transfer-row.paused    .bar > span { background: var(--accent-warning); }

.sidebar-transfer-row .actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.sidebar-transfer-row .actions button {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 10px;
    transition: var(--transition);
}

.sidebar-transfer-row .actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-transfer-row .actions button.danger {
    border-color: rgba(255, 59, 95, 0.4);
    color: var(--accent-danger);
}

/* Tunnel info card */
.tunnel-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}

.tunnel-status {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tunnel-status.active   { color: var(--accent-success); }
.tunnel-status.starting { color: var(--accent-warning); }
.tunnel-status.error    { color: var(--accent-danger);  }

.tunnel-url {
    color: var(--accent-primary);
    word-break: break-all;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
}

/* Compress modal source list */
.compress-sources {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    max-height: 140px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--text-secondary);
}

.compress-sources .item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
}

.compress-sources .item i {
    color: var(--accent-primary);
}

/* ── Server Bridge ─────────────────────────────────────────────────────── */

.bridge-actions {
    margin-bottom: 8px;
}

.bridge-peer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 12px;
}

.bridge-peer-icon {
    color: var(--accent-primary);
    flex-shrink: 0;
    font-size: 12px;
}

.bridge-peer-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.bridge-code-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.bridge-code-box textarea {
    width: 100%;
    font-family: monospace;
    font-size: 11px;
    resize: none;
    background: var(--bg-secondary);
    color: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px;
    word-break: break-all;
}

/* ── Peer connection tab bar ─────────────────────────────────────────────── */

.tab-bar {
    display: flex;
    align-items: stretch;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    min-height: 36px;
    flex-shrink: 0;
    overflow-x: auto;
    gap: 2px;
    padding: 0 6px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .18s, border-color .18s, background .18s;
    white-space: nowrap;
    user-select: none;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab .tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 10px;
    opacity: .55;
    margin-left: 2px;
    transition: opacity .18s, background .18s;
}

.tab .tab-close:hover {
    opacity: 1;
    background: rgba(255, 59, 95, .25);
    color: var(--accent-danger);
}

/* ── Status bar peer badge ────────────────────────────────────────────────── */

.peer-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: rgba(0, 255, 198, .10);
    border: 1px solid rgba(0, 255, 198, .25);
    color: var(--accent-primary);
}

.peer-badge i {
    font-size: 11px;
}

/* ── Remote toolbar actions visibility helper ────────────────────────────── */

.hidden {
    display: none !important;
}
