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

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-primary: #58a6ff;
    --accent-hover: #79c0ff;
    --success: #3fb950;
    --error: #f85149;
    --warning: #d29922;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --border-color: #d0d7de;
    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --accent-primary: #0969da;
    --accent-hover: #0550ae;
    --success: #1a7f37;
    --error: #cf222e;
    --warning: #9a6700;
}

/* Light theme adjustments for specific elements */
[data-theme="light"] .preview-code-container,
[data-theme="light"] .preview-text,
[data-theme="light"] .markdown-source pre {
    background-color: #f6f8fa;
}

[data-theme="light"] .line-numbers {
    background-color: #f6f8fa;
    border-right-color: #d0d7de;
}

[data-theme="light"] #pdf-canvas {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Global drop overlay */
.drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(88, 166, 255, 0.15);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drop-overlay-content {
    text-align: center;
    padding: 3rem;
    background-color: var(--bg-secondary);
    border: 3px dashed var(--accent-primary);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.drop-overlay-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.drop-overlay-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-overlay-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-list.drag-over {
    background-color: rgba(88, 166, 255, 0.05);
    border-color: var(--accent-primary);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-pubkey {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
    background-color: var(--border-color);
}

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

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

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

.btn .icon {
    margin-right: 0.25rem;
}

.btn-accent {
    background-color: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-accent:hover:not(:disabled) {
    background-color: #2ea043;
    border-color: #2ea043;
}

/* New dropdown menu */
.new-dropdown {
    position: relative;
    display: inline-block;
}

.new-dropdown .dropdown-arrow {
    margin-left: 0.25rem;
    font-size: 0.7rem;
}

.new-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
}

.new-dropdown-content.show {
    display: block;
}

.new-dropdown-content .dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
}

.new-dropdown-content .dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.new-dropdown-content .dropdown-icon {
    margin-right: 0.75rem;
    font-size: 1rem;
}

.new-dropdown-content .dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb-item {
    cursor: pointer;
}

.breadcrumb-item:hover {
    color: var(--accent-primary);
}

/* Content area */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: border-color 0.15s, background-color 0.15s;
}

.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background-color: rgba(88, 166, 255, 0.1);
}

.drop-zone-text {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-zone-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* File list */
.file-list {
    flex: 1;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.file-list-header {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.file-col {
    padding: 0 0.5rem;
}

.file-name {
    flex: 1;
}

.file-size {
    width: 100px;
    text-align: right;
    flex-shrink: 0;
}

.file-date {
    width: 150px;
    text-align: right;
    flex-shrink: 0;
}

.file-actions {
    width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.file-list-body {
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

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

.file-list.view-list .file-list-body {
    display: block;
}

/* Virtual scrolling */
.virtual-scroll-wrapper {
    position: relative;
}

.virtual-scroll-viewport {
    position: absolute;
    left: 0;
    right: 0;
}

/* File item */
.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.15s;
}

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

.file-item:last-child {
    border-bottom: none;
}

.file-item.selected {
    background-color: rgba(88, 166, 255, 0.1);
}

/* Batch toolbar */
.batch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.batch-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.batch-info input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.batch-actions {
    display: flex;
    gap: 0.5rem;
}

/* File checkbox column */
.file-col.file-select {
    width: 30px;
    flex-shrink: 0;
}

.file-checkbox,
.folder-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Drag and drop states */
.file-item.dragging {
    opacity: 0.5;
}

.folder-item.drag-target,
.folder-grid-item.drag-target {
    background-color: rgba(88, 166, 255, 0.2);
    outline: 2px dashed var(--accent-primary);
    outline-offset: -2px;
}

.file-item .file-icon {
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image thumbnails */
.file-thumbnail {
    width: 32px;
    height: 32px;
    margin-right: 0.75rem;
    object-fit: cover;
    border-radius: 4px;
    background-color: var(--bg-tertiary);
    transition: opacity 0.2s;
}

.file-thumbnail:not(.loaded) {
    opacity: 0.3;
}

.file-thumbnail.loaded {
    opacity: 1;
    font-size: 1rem;
}

.file-item .file-name {
    display: flex;
    align-items: center;
}

/* Star button */
.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    margin-right: 0.5rem;
    color: var(--text-secondary);
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s;
}

.star-btn:hover {
    opacity: 1;
}

.star-btn.starred {
    color: var(--warning);
    opacity: 1;
}

.file-item .file-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.file-item .file-name-text:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

.file-item .file-size,
.file-item .file-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-item .file-size {
    width: 100px;
    flex-shrink: 0;
    text-align: right;
}

.file-item .file-date {
    width: 150px;
    flex-shrink: 0;
    text-align: right;
}

.file-item .file-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    width: 60px;
    flex-shrink: 0;
}

/* File tags */
.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tag-chip .tag-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.tag-chip .tag-remove:hover {
    opacity: 1;
    color: var(--error);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 32px;
}

.tags-container .no-tags {
    color: var(--text-secondary);
    font-style: italic;
}

.tags-file-name {
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tag-input-wrapper {
    position: relative;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
}

.tag-suggestion {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.tag-suggestion:hover {
    background-color: var(--bg-tertiary);
}

/* Notifications */
.notification-badge {
    background-color: var(--error);
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notification-badge:empty {
    display: none;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background-color: rgba(77, 120, 204, 0.1);
}

.notification-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.notification-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.notification-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

.no-notifications {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem;
    font-style: italic;
}

/* Activity log */
.activity-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.activity-filters select {
    flex: 1;
    max-width: 200px;
}

.activity-list {
    max-height: 500px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 1.25rem;
    width: 32px;
    text-align: center;
}

.activity-details {
    flex: 1;
}

.activity-text {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-text strong {
    color: var(--accent-primary);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.no-activity {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem;
    font-style: italic;
}

.modal-wide {
    max-width: 700px;
}

/* File comments */
.comments-file-name {
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.comments-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.comment-item {
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
}

.comment-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.comment-action-btn:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.comment-action-btn.delete:hover {
    color: var(--error);
}

.comment-text {
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
}

.comment-input-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-input-area textarea {
    resize: vertical;
    min-height: 80px;
}

.comment-input-area button {
    align-self: flex-end;
}

.no-comments {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

.comment-count {
    font-size: 0.75rem;
    background: var(--accent-primary);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* Folder customization */
.customize-btn {
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.customize-btn:hover {
    opacity: 1;
}

.folder-name-display {
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.customize-section {
    margin-bottom: 1.5rem;
}

.customize-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-primary);
}

.color-swatch.default {
    background: linear-gradient(135deg, #e0e0e0 50%, #b0b0b0 50%);
    position: relative;
}

.color-swatch.default::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
}

.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.icon-option:hover {
    transform: scale(1.1);
    border-color: var(--text-secondary);
}

.icon-option.selected {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.file-item .action-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
}

.file-item .action-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.file-item .action-btn.menu-btn {
    font-size: 1.25rem;
    font-weight: bold;
    letter-spacing: 0.1rem;
    padding: 0.25rem 0.5rem;
    border: none;
}

.file-item .action-btn.delete:hover {
    border-color: var(--error);
    color: var(--error);
}

/* Empty state */
.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-subtext {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Trash view */
.trash-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.trash-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.trash-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.trash-item .file-select {
    width: 40px;
    flex-shrink: 0;
}

.trash-checkbox {
    cursor: pointer;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.skeleton-text {
    height: 14px;
    flex: 1;
    max-width: 200px;
}

.skeleton-text-short {
    height: 14px;
    width: 60px;
}

/* Offline indicator */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--warning);
    color: #000;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-banner.visible {
    transform: translateY(0);
}

/* Error state */
.error-state {
    padding: 2rem;
    text-align: center;
    color: var(--danger);
}

.error-state-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.retry-btn {
    margin-top: 1rem;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn .spinner {
    width: 14px;
    height: 14px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

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

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

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

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

/* Upload drop zone in modal */
.upload-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
    border-color: var(--accent-primary);
    background-color: rgba(88, 166, 255, 0.1);
}

/* Upload list */
.upload-list {
    margin-top: 1rem;
}

.upload-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.upload-item:last-child {
    margin-bottom: 0;
}

.upload-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.upload-item-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 1rem;
}

.upload-item-status {
    margin-left: 1rem;
    font-size: 0.75rem;
}

.upload-item-status.pending {
    color: var(--text-secondary);
}

.upload-item-status.encrypting {
    color: var(--success);
}

.upload-item-status.hashing {
    color: var(--warning);
}

.upload-item-status.uploading {
    color: var(--accent-primary);
}

.upload-item-status.publishing {
    color: var(--accent-hover);
}

.upload-item-status.success {
    color: var(--success);
}

.upload-item-status.error {
    color: var(--error);
}

.upload-item-remove {
    margin-left: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

.upload-item-remove:hover {
    color: var(--error);
}

/* Progress bar */
.progress-bar {
    width: 100px;
    height: 4px;
    background-color: var(--bg-primary);
    border-radius: 2px;
    margin-left: 1rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent-primary);
    transition: width 0.2s;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
}

.toast {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem 1.5rem;
    margin-top: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.2s ease-out;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

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

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Hidden utility */
.hidden {
    display: none !important;
}

/* ============================================
   Landing Page
   ============================================ */
.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.landing-hero {
    text-align: center;
    max-width: 800px;
}

.landing-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.landing-logo {
    height: 80px;
    width: auto;
}

.landing-drive-suffix {
    font-family: Georgia, serif;
    font-size: 70px;
    color: #A78BFA;
    margin-left: -0.15em;
    letter-spacing: -0.02em;
}

.landing-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.landing-tagline {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature {
    padding: 1.5rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.landing-auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.login-progress {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    animation: fadeInUp 0.3s ease-out;
}

.login-progress .spinner {
    flex-shrink: 0;
}

.login-progress span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
}

.auth-help {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.auth-help a:hover {
    text-decoration: underline;
}

/* ============================================
   Access Denied Page
   ============================================ */
.access-denied {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.access-denied-content {
    text-align: center;
    max-width: 400px;
}

.access-denied-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.access-denied-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--error);
}

.access-denied-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.pubkey-display {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    word-break: break-all;
}

.access-denied-help {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   File Explorer
   ============================================ */
.explorer {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header-logo {
    width: 32px;
    height: 32px;
    margin-right: 0.75rem;
}

.header-left {
    display: flex;
    align-items: center;
}

/* Toolbar improvements */
.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    gap: 0.5rem;
}

.toolbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.toolbar-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sort-dropdown {
    position: relative;
}

.sort-select {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 130px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

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

/* Breadcrumb improvements */
.breadcrumb {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.breadcrumb-item {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

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

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

.breadcrumb-sep {
    color: var(--border-color);
    margin: 0 0.25rem;
}

/* ============================================
   Context Menu
   ============================================ */
.context-menu {
    position: fixed;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 3000;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-menu-item:hover {
    background-color: var(--bg-tertiary);
}

.context-menu-item.danger {
    color: var(--error);
}

.context-menu-item.danger:hover {
    background-color: rgba(248, 81, 73, 0.1);
}

.context-menu-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

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

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.grid-item:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.grid-item-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.grid-item-name {
    font-size: 0.875rem;
    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;
}

.grid-item-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Folder styling */
.folder-item,
.folder-grid-item {
    cursor: pointer;
}

.folder-item .file-icon,
.folder-item .grid-item-icon,
.folder-grid-item .grid-item-icon,
.folder-icon {
    color: var(--warning);
}

.folder-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.folder-grid-item:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--warning);
}

.folder-grid-item .grid-item-actions {
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.folder-grid-item:hover .grid-item-actions {
    opacity: 1;
}

.grid-item .grid-item-actions {
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.grid-item:hover .grid-item-actions {
    opacity: 1;
}

.folder-drop-target {
    outline: 2px dashed var(--accent-primary);
    outline-offset: -2px;
    background-color: rgba(88, 166, 255, 0.1) !important;
}

/* Breadcrumb separator */
.breadcrumb-separator {
    color: var(--border-color);
    margin: 0 0.25rem;
}

/* ============================================
   Modal improvements
   ============================================ */
.modal-small {
    max-width: 400px;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

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

.modal-help a:hover {
    text-decoration: underline;
}

/* File Info Modal */
.file-info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    flex-shrink: 0;
    width: 80px;
}

.info-value {
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: right;
    word-break: break-word;
}

.info-hash {
    font-family: monospace;
    font-size: 0.75rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.file-info-actions .btn {
    flex: 1;
    min-width: 70px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* Input styling */
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
}

.input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.input::placeholder {
    color: var(--text-secondary);
}

/* NIP-46 connection status */
.nip46-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.nip46-status.error {
    background-color: rgba(248, 81, 73, 0.1);
    color: var(--error);
}

.nip46-status.success {
    background-color: rgba(63, 185, 80, 0.1);
    color: var(--success);
}

/* Form groups */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Share modal */
.share-file-name {
    font-weight: 500;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    word-break: break-all;
}

.share-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.share-status.success {
    background-color: rgba(63, 185, 80, 0.1);
    color: var(--success);
}

.share-status.error {
    background-color: rgba(248, 81, 73, 0.1);
    color: var(--error);
}

/* Share button in file actions */
.action-btn.share-btn {
    color: var(--accent-primary);
}

.action-btn.share-btn:hover {
    background-color: rgba(88, 166, 255, 0.1);
}

/* View tabs */
.view-tabs {
    display: flex;
    gap: 0.5rem;
    background-color: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: 6px;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}

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

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

/* Search box */
.search-box {
    position: relative;
    margin-left: 1rem;
}

.search-input {
    width: 200px;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    transition: width 0.2s, border-color 0.15s;
}

.search-input:focus,
.search-box.filter-open .search-input,
.search-box.has-content .search-input {
    outline: none;
    border-color: var(--accent-primary);
    width: 280px;
}

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

.search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: normal;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.search-clear:hover {
    color: var(--error);
    transform: translateY(-50%) scale(1.15);
}

.search-filter-btn {
    position: absolute;
    right: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.search-filter-btn:hover {
    color: var(--accent-primary);
    opacity: 1;
}

.search-filter-btn.active {
    color: var(--accent-primary);
    opacity: 1;
}

.search-filters {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    min-width: 280px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Search results indicator */
.search-results-info {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.search-highlight {
    background-color: rgba(88, 166, 255, 0.3);
    border-radius: 2px;
}

/* Breadcrumb bar */
.breadcrumb-bar {
    margin-bottom: 1rem;
}

/* Shared file item styling */
.file-item.shared-item {
    background-color: rgba(88, 166, 255, 0.05);
}

.file-item.shared-item .shared-by {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.grid-item.shared-item {
    border-color: var(--accent-primary);
    border-style: dashed;
}

/* ============================================
   Drag and Drop Styling
   ============================================ */
.file-list.drag-over {
    background-color: rgba(88, 166, 255, 0.05);
}

.file-list.drag-over::after {
    content: 'Drop files to upload';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    color: var(--accent-primary);
    pointer-events: none;
}

/* ============================================
   Floating Upload Progress Indicator
   ============================================ */
.upload-progress-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transition: opacity 0.2s, transform 0.2s;
}

.upload-progress-indicator.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.upload-progress-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.upload-progress-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.upload-progress-text {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-progress-status {
    font-size: 0.875rem;
    color: var(--text-primary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-progress-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

.upload-progress-bar-container {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

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

/* ============================================
   Encrypted Files
   ============================================ */
.encrypted-file {
    background-color: rgba(63, 185, 80, 0.05);
}

.encrypted-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    margin-left: 0.5rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: var(--success);
    color: var(--bg-primary);
    border-radius: 4px;
    letter-spacing: 0.025em;
}

.grid-item .encrypted-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.grid-item {
    position: relative;
}

/* Collaborative document badge */
.collab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    margin-left: 0.5rem;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.025em;
}

.grid-item .collab-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* Collaborative document item styling */
.file-item.collab-doc,
.grid-item.collab-doc {
    cursor: pointer;
}

.file-item.collab-doc:hover,
.grid-item.collab-doc:hover {
    background: rgba(79, 70, 229, 0.1);
}

.file-item.collab-doc .open-btn {
    font-size: 1rem;
}

/* ============================================
   Keyboard Shortcuts Modal
   ============================================ */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
}

.shortcut-item:hover {
    background-color: var(--bg-tertiary);
}

.shortcut-item kbd {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    min-width: 2rem;
    text-align: center;
}

.shortcut-item span {
    color: var(--text-secondary);
}

/* ============================================
   Encryption Info Modal
   ============================================ */
.encryption-status-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background-color: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--success);
    border-radius: 8px;
}

.encryption-icon-large {
    font-size: 1.5rem;
}

.encryption-status-text {
    font-weight: 600;
    color: var(--success);
}

.encryption-info-section {
    margin-bottom: 1.25rem;
}

.encryption-info-section:last-child {
    margin-bottom: 0;
}

.encryption-info-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.encryption-algorithm {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin: 0;
}

.encryption-storage-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.key-hierarchy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.key-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 100%;
    text-align: center;
}

.key-node-root {
    border-color: var(--accent-primary);
    background-color: rgba(88, 166, 255, 0.1);
}

.key-node-folder {
    border-color: var(--warning);
    background-color: rgba(210, 153, 34, 0.1);
}

.key-node-file {
    border-color: var(--success);
    background-color: rgba(63, 185, 80, 0.1);
}

.key-node-icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.key-node-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.key-node-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.key-arrow {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .main {
        padding: 1rem;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .toolbar-center {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .file-date {
        display: none;
    }

    .file-list-header .file-date {
        display: none;
    }

    .landing-features {
        grid-template-columns: 1fr;
    }

    .landing-logo {
        height: 60px;
    }

    .landing-drive-suffix {
        font-size: 52px;
    }

    .landing-title {
        font-size: 2rem;
    }

    .landing-tagline {
        font-size: 1rem;
    }

    .landing-auth {
        width: 100%;
    }

    .btn-large {
        width: 100%;
    }
}

/* ============================================
   Version History Modal
   ============================================ */
.version-file-name {
    font-weight: 500;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.version-list {
    max-height: 400px;
    overflow-y: auto;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s;
}

.version-item:hover {
    background-color: var(--bg-tertiary);
}

.version-item:last-child {
    border-bottom: none;
}

.version-info {
    flex: 1;
}

.version-number {
    font-weight: 600;
    color: var(--text-primary);
}

.version-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.version-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.version-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.version-actions {
    display: flex;
    gap: 0.5rem;
}

.version-current {
    background-color: rgba(88, 166, 255, 0.1);
}

.version-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: var(--accent-primary);
    color: white;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* ========================================
   Share Management Modal
   ======================================== */

.share-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.share-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s;
}

.share-item:hover {
    background-color: var(--bg-tertiary);
}

.share-item:last-child {
    border-bottom: none;
}

.share-item.expired {
    opacity: 0.6;
}

.share-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.share-recipient {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.share-permission {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-secondary);
}

.share-expiry {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.share-actions-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.share-actions-section h4 {
    margin: 0 0 0.5rem 0;
    color: var(--danger);
}

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

.btn-danger:hover {
    background-color: #c82333;
}

/* ============================================
   Public Link Modal
   ============================================ */
.public-link-file-name {
    font-weight: 500;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    word-break: break-all;
}

.public-link-result {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.public-link-url-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.public-link-url-container .input {
    flex: 1;
    font-family: monospace;
    font-size: 0.75rem;
}

.public-link-warning {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--warning);
}

/* ============================================
   Editor Modal
   ============================================ */
.modal-large {
    max-width: 900px;
    height: 80vh;
}

.modal-large .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: 1rem;
}

.editor-collaborators {
    display: flex;
    gap: -0.5rem;
}

.editor-collaborator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    border: 2px solid var(--bg-secondary);
    margin-left: -8px;
}

.editor-collaborator:first-child {
    margin-left: 0;
}

.editor-body {
    flex: 1;
    display: flex;
    padding: 0 !important;
}

.editor-textarea {
    flex: 1;
    width: 100%;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background-color: var(--bg-primary);
    border: none;
    color: var(--text-primary);
    resize: none;
}

.editor-textarea:focus {
    outline: none;
}

.editor-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: auto;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ============================================
   Backup Modal
   ============================================ */
.backup-section {
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.backup-section:last-child {
    margin-bottom: 0;
}

.backup-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.backup-section .modal-description {
    margin-bottom: 0.75rem;
}

/* ============================================
   Relay Settings Modal
   ============================================ */
.relay-list {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.relay-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem;
}

.relay-item:last-child {
    border-bottom: none;
}

.relay-url {
    flex: 1;
    font-size: 0.8125rem;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relay-badge {
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.relay-badge.active {
    background-color: var(--accent-primary);
    color: white;
}

.relay-badge.inactive {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.relay-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
}

.relay-remove:hover {
    color: var(--error);
}

.relay-add-row {
    display: flex;
    gap: 0.5rem;
}

.relay-add-row .input {
    flex: 1;
}

.relay-add-options {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.relay-source-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.relay-list-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   Migration Modal
   ============================================ */
.migration-files {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.migration-file {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.migration-file:last-child {
    border-bottom: none;
}

.migration-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.migration-file-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.migration-progress {
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.progress-bar-container {
    height: 8px;
    background-color: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: var(--accent-primary);
    transition: width 0.3s ease;
    width: 0%;
}

#migration-status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ============================================
   Search Results Enhancement
   ============================================ */
.search-result-score {
    font-size: 0.625rem;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* ============================================
   File Actions Enhancement
   ============================================ */
.file-actions-expanded {
    width: 200px;
}

.action-btn.history-btn {
    color: var(--warning);
}

.action-btn.link-btn {
    color: var(--success);
}

.action-btn.edit-btn {
    color: var(--accent-primary);
}

/* ============================================
   Crypto Progress Indicator
   ============================================ */
.crypto-progress-indicator {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 3500;
    animation: slideUp 0.3s ease;
}

.crypto-progress-indicator.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.crypto-progress-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

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

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

.crypto-progress-text {
    display: flex;
    flex-direction: column;
}

.crypto-progress-operation {
    font-weight: 500;
    font-size: 0.875rem;
}

.crypto-progress-file {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.crypto-progress-bar-container {
    height: 4px;
    background-color: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.crypto-progress-bar {
    height: 100%;
    background-color: var(--accent-primary);
    transition: width 0.2s ease;
}

/* ============================================
   Share Expiration Badge
   ============================================ */
.share-expires {
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    background-color: var(--warning);
    color: var(--bg-primary);
    font-weight: 500;
    margin-left: 0.5rem;
}

.share-expires.expired {
    background-color: var(--error);
}

.file-item.expired {
    opacity: 0.5;
}

.file-item.expired .file-name-text {
    text-decoration: line-through;
}

/* ============================================
   Collaborator Indicators
   ============================================ */
.collaborator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.625rem;
    font-weight: 600;
    color: white;
    margin-right: -8px;
    border: 2px solid var(--bg-secondary);
}

.collaborator:last-child {
    margin-right: 0;
}

#editor-collaborators {
    display: flex;
    align-items: center;
}

/* ============================================
   Version History Item
   ============================================ */
.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.version-item:last-child {
    border-bottom: none;
}

.version-item:hover {
    background-color: var(--bg-tertiary);
}

.version-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.version-number {
    font-weight: 600;
    font-size: 0.875rem;
}

.version-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.version-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.version-note {
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-style: italic;
}

.version-autosave {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-secondary);
}

.version-actions {
    display: flex;
    gap: 0.5rem;
}

.version-current {
    font-size: 0.75rem;
    color: var(--success);
    padding: 0.25rem 0.5rem;
}

.btn.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ============================================
   File Preview Modal
   ============================================ */
.preview-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 0 !important;
    overflow: hidden;
}

.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.preview-image {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

/* Code preview container with syntax highlighting */
.preview-code-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 65vh;
    border-radius: 8px;
    overflow: hidden;
    background-color: #282c34; /* Match atom-one-dark theme */
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #21252b;
    border-bottom: 1px solid #181a1f;
}

.code-language {
    font-size: 12px;
    color: #abb2bf;
    text-transform: uppercase;
}

.code-actions {
    display: flex;
    gap: 8px;
}

.code-btn {
    background: #3a3f4b;
    border: none;
    color: #abb2bf;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.code-btn:hover {
    background: #4d78cc;
    color: white;
}

.code-btn.active {
    background: #4d78cc;
    color: white;
}

.code-body {
    display: flex;
    flex: 1;
    overflow: auto;
}

.line-numbers {
    padding: 1rem 0;
    padding-right: 0.75rem;
    padding-left: 1rem;
    background-color: #282c34;
    color: #636d83;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    border-right: 1px solid #3a3f4b;
    min-width: 40px;
}

.preview-text {
    flex: 1;
    margin: 0;
    padding: 1rem;
    overflow: auto;
    background-color: #282c34;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #abb2bf;
    white-space: pre;
}

.preview-text.wrap {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.preview-text code {
    font-family: inherit;
    font-size: inherit;
    background: transparent;
    padding: 0;
}

/* Override highlight.js background */
.preview-text code.hljs {
    background: transparent;
    padding: 0;
}

/* Markdown preview */
.preview-markdown-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 65vh;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

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

.markdown-tabs {
    display: flex;
    gap: 4px;
}

.markdown-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

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

.markdown-tab.active {
    background-color: var(--accent-primary);
    color: white;
}

.markdown-content,
.markdown-source {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
}

.markdown-content {
    line-height: 1.7;
    color: var(--text-primary);
}

/* Markdown rendered styles */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.markdown-content h1 { font-size: 2em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.markdown-content h2 { font-size: 1.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.markdown-content h3 { font-size: 1.25em; }
.markdown-content h4 { font-size: 1em; }
.markdown-content h5 { font-size: 0.875em; }
.markdown-content h6 { font-size: 0.85em; color: var(--text-secondary); }

.markdown-content p {
    margin: 1em 0;
}

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

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content ul,
.markdown-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.markdown-content li {
    margin: 0.25em 0;
}

.markdown-content blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid var(--accent-primary);
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.markdown-content code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
}

.markdown-content pre {
    margin: 1em 0;
    padding: 1em;
    background-color: #282c34;
    border-radius: 8px;
    overflow-x: auto;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--border-color);
    padding: 0.5em 1em;
    text-align: left;
}

.markdown-content th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2em 0;
}

.markdown-content input[type="checkbox"] {
    margin-right: 0.5em;
}

.markdown-source pre {
    margin: 0;
    background: #282c34;
    color: #abb2bf;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.markdown-source code {
    font-family: inherit;
}

/* PDF container with controls */
.preview-pdf-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 65vh;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
}

.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 8px;
}

.pdf-nav,
.pdf-zoom,
.pdf-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pdf-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background-color 0.2s;
}

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

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

.pdf-page-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}

#pdf-page-input {
    width: 50px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    text-align: center;
    font-size: 14px;
}

#pdf-page-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#pdf-zoom-select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.pdf-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    background-color: var(--bg-tertiary);
}

#pdf-canvas {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background-color: white;
}

.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

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

/* Video container */
.preview-video-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.preview-video {
    max-width: 100%;
    max-height: 55vh;
    background-color: #000;
    border-radius: 8px 8px 0 0;
}

/* Audio container */
.preview-audio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.audio-visualization {
    width: 100%;
    height: 100px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--accent-primary);
}

.audio-visualization::before {
    content: '\\1F3B5';
}

.preview-audio {
    display: none;
}

/* Media controls */
.media-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 0 0 8px 8px;
    width: 100%;
}

.audio-controls {
    border-radius: 0 0 8px 8px;
}

.media-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.15s;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.play-btn {
    font-size: 1.25rem;
}

.media-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.media-seek {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 3px;
    cursor: pointer;
}

.media-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
}

.media-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.media-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 90px;
}

.media-right-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 2px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.playback-speed {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.playback-speed:focus {
    outline: none;
    border-color: var(--accent-primary);
}

@media (max-width: 768px) {
    .media-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .media-progress {
        order: 2;
        width: 100%;
    }

    .media-right-controls {
        order: 1;
    }

    .volume-slider {
        width: 60px;
    }

    .media-time {
        min-width: 70px;
        font-size: 0.7rem;
    }
}

.preview-unsupported {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.preview-unsupported p {
    margin-bottom: 1rem;
}

/* ============================================
   Folder Tree Sidebar
   ============================================ */
.explorer-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    min-width: 200px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}

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

.sidebar-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-toggle {
    padding: 0.25rem;
    font-size: 1rem;
}

.folder-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.folder-tree-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
}

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

.folder-tree-item.active {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
}

.folder-tree-item.root {
    font-weight: 600;
}

.folder-tree-icon {
    margin-right: 0.5rem;
    font-size: 1rem;
}

.folder-tree-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-tree-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.625rem;
    transition: transform 0.15s ease;
}

.folder-tree-toggle.expanded {
    transform: rotate(90deg);
}

.folder-tree-children {
    padding-left: 1rem;
}

.folder-tree-children.collapsed {
    display: none;
}

.folder-tree-empty {
    padding: 0.5rem 1rem 0.5rem 2rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-style: italic;
}

/* Storage usage indicator */
.storage-usage {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.storage-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.storage-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.storage-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.storage-bar {
    height: 4px;
    background-color: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background-color: var(--accent-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.storage-bar-fill.warning {
    background-color: var(--warning);
}

.storage-bar-fill.danger {
    background-color: var(--error);
}

.storage-details {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Sidebar navigation section */
.sidebar-section {
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color 0.15s, color 0.15s;
    font-size: 0.875rem;
}

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

.sidebar-nav-item.active {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
}

.sidebar-nav-icon {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar-nav-name {
    flex: 1;
}

.sidebar-nav-badge {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    min-width: 20px;
    text-align: center;
}

.sidebar-nav-badge:empty {
    display: none;
}

/* Main content adjustment when sidebar is present */
.explorer-content .main {
    flex: 1;
    overflow: hidden;
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

/* Tablet and smaller */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        min-width: 160px;
    }

    .file-col.file-date {
        display: none;
    }

    .toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .toolbar-center {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header-logo {
        width: 28px;
        height: 28px;
    }

    .logo {
        font-size: 1.25rem;
    }

    .user-pubkey {
        display: none;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        z-index: 100;
        width: 260px;
        min-width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .explorer-content {
        flex-direction: column;
    }

    .main {
        width: 100%;
    }

    .toolbar {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .toolbar-left {
        gap: 0.5rem;
    }

    .toolbar-left .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .toolbar-left .btn .icon {
        margin-right: 0.25rem;
    }

    .toolbar-center {
        flex: 1;
        order: 2;
    }

    .view-tabs {
        display: none;
    }

    .search-box {
        width: 100%;
    }

    .toolbar-right {
        gap: 0.25rem;
    }

    /* Mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
        order: -1;
    }

    .file-list-header {
        display: none;
    }

    .file-item {
        padding: 0.75rem;
    }

    .file-col.file-size,
    .file-col.file-date {
        display: none;
    }

    .file-col.file-name {
        flex: 1;
    }

    .file-col.file-actions {
        display: flex;
        gap: 0.25rem;
    }

    .file-col.file-actions .action-btn {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    /* Hide text labels on action buttons */
    .file-col.file-actions .action-btn:not(.delete-btn) {
        font-size: 0;
    }

    .file-col.file-actions .action-btn::before {
        font-size: 1rem;
    }

    .file-col.file-actions .preview-btn::before { content: '\\1F441'; }
    .file-col.file-actions .edit-btn::before { content: '\\270E'; }
    .file-col.file-actions .history-btn::before { content: '\\1F4C5'; }
    .file-col.file-actions .link-btn::before { content: '\\1F517'; }
    .file-col.file-actions .share-btn::before { content: '\\2197'; }
    .file-col.file-actions .download-btn::before { content: '\\2193'; }
    .file-col.file-actions .delete-btn::before { content: '\\2715'; }

    .file-col.file-actions .delete-btn {
        font-size: 0;
    }

    /* Grid view adjustments */
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .grid-item {
        padding: 0.75rem;
    }

    .grid-item-icon {
        font-size: 2rem;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-content.modal-large {
        width: 95%;
        height: calc(100vh - 2rem);
    }

    .modal-content.modal-small {
        width: 95%;
    }

    /* Preview adjustments */
    .preview-image {
        max-height: 50vh;
    }

    .preview-pdf {
        height: 50vh;
    }

    /* Landing page */
    .landing-brand {
        flex-direction: column;
        gap: 0;
    }

    .landing-logo {
        height: 50px;
    }

    .landing-drive-suffix {
        font-size: 44px;
        margin-left: 0;
    }

    .landing-features {
        flex-direction: column;
        gap: 1.5rem;
    }

    .feature {
        width: 100%;
    }

    .landing-auth {
        flex-direction: column;
        gap: 0.75rem;
    }

    .landing-auth .btn {
        width: 100%;
    }

    /* Breadcrumbs */
    .breadcrumb {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .breadcrumb-item {
        font-size: 0.875rem;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .header {
        padding: 0.5rem 0.75rem;
    }

    .toolbar-left .btn span.icon + span {
        display: none;
    }

    .toolbar-left .btn span.icon {
        margin-right: 0;
    }

    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .upload-progress-indicator,
    .crypto-progress-indicator {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        max-width: none;
    }
}

/* ============================================
   Touch Interactions
   ============================================ */

/* Touch feedback */
.file-item.touch-active,
.folder-item.touch-active {
    background-color: var(--bg-tertiary);
    transform: scale(0.98);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

/* Larger touch targets on mobile */
@media (hover: none) and (pointer: coarse) {
    .file-item {
        min-height: 56px;
        padding: 0.875rem 1rem;
    }

    .folder-item {
        min-height: 56px;
        padding: 0.875rem 1rem;
    }

    .file-checkbox,
    .folder-checkbox {
        width: 24px;
        height: 24px;
    }

    .action-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.75rem;
    }

    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .context-menu-item {
        min-height: 48px;
        padding: 0.875rem 1rem;
        display: flex;
        align-items: center;
    }

    /* Swipe actions */
    .file-item {
        position: relative;
        overflow: hidden;
    }

    .file-item.swipe-left {
        transform: translateX(-80px);
        transition: transform 0.2s ease;
    }

    .file-item.swipe-left::after {
        content: 'Delete';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 80px;
        background-color: var(--error);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 500;
    }
}

/* Prevent text selection during touch */
.file-item,
.folder-item {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Pull to refresh indicator (future enhancement placeholder) */
.pull-to-refresh {
    height: 0;
    overflow: hidden;
    text-align: center;
    color: var(--text-secondary);
    transition: height 0.2s ease;
}

.pull-to-refresh.active {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Desktop Sync Status (Tauri only)
   ============================================ */

.sync-status-section {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sync-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.sync-info {
    margin-bottom: 0.5rem;
}

.sync-status-text {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sync-status-text::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sync-status-text.synced::before {
    background-color: var(--success);
}

.sync-status-text.syncing::before {
    background-color: var(--accent-primary);
    animation: pulse 1.5s ease-in-out infinite;
}

.sync-status-text.pending::before {
    background-color: var(--warning);
}

.sync-status-text.paused::before {
    background-color: var(--text-secondary);
}

.sync-status-text.error::before {
    background-color: var(--error);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.sync-progress-bar {
    height: 4px;
    background-color: var(--bg-tertiary);
    border-radius: 2px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.sync-progress-fill {
    height: 100%;
    background-color: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.sync-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sync-actions .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
}

.sync-folder-info {
    margin-top: 0.5rem;
}

.btn-full {
    width: 100%;
}

.btn-small {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
}

/* Input with button combo */
.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button .input {
    flex: 1;
}

/* Checkbox label styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
