/**
 * AFSNote - File Manager Styles
 * Saved notes browser with search, folders, and pinning
 */

.file-manager-header {
    background: var(--header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--divider);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.back-button {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    margin-left: -4px;
    transition: opacity var(--transition-fast);
}

.back-button:hover {
    opacity: 0.7;
}

.file-manager-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

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

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
}

.search-bar svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
}

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

/* File Manager Body */
.file-manager-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Folders Sidebar */
.folders-sidebar {
    width: 200px;
    background: var(--surface);
    border-right: 1px solid var(--divider);
    overflow-y: auto;
    display: none;
}

@media (min-width: 900px) {
    .folders-sidebar {
        display: block;
    }
}

.folders-list {
    padding: 8px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}

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

.folder-item.active {
    background: var(--accent);
    color: white;
}

.folder-item svg {
    opacity: 0.7;
}

.file-manager-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Notes List Panel */
.notes-list-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

.notes-list-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    text-align: center;
    gap: 12px;
}

.notes-list-empty.show {
    display: flex;
}

.notes-list-empty p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin: 0;
}

/* Note Item */
.note-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--divider);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.note-item:hover {
    background: var(--divider);
}

.note-item:active {
    background: var(--border);
}

.note-item.active {
    background: var(--accent);
}

.note-item.active .note-item-title,
.note-item.active .note-item-date,
.note-item.active .note-item-icon {
    color: white;
}

.note-item.active .note-pin-btn {
    color: white;
}

.note-item.pinned {
    background: var(--surface);
    border-left: 3px solid var(--accent);
}

.note-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.note-item-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.note-item-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-item-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.note-item-folder {
    font-size: 12px;
}

.note-pin-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: all var(--transition-fast);
}

.note-pin-btn:hover,
.note-pin-btn.active {
    opacity: 1;
    color: var(--accent);
}

/* Preview Action Buttons */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--divider);
    color: var(--text);
}

/* Resize Handle */
.resize-handle {
    display: none;
    height: 20px;
    background: var(--surface);
    cursor: row-resize;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    touch-action: none;
    border-top: 1px solid var(--divider);
    border-bottom: 1px solid var(--divider);
}

.resize-indicator {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    transition: background var(--transition-fast);
}

.resize-handle:hover .resize-indicator,
.resize-handle.dragging .resize-indicator {
    background: var(--accent);
}

/* Preview Panel */
.preview-panel {
    display: none;
    flex-direction: column;
    background: var(--surface);
}

.preview-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 50;
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.preview-title {
    font-weight: 600;
    font-size: 17px;
    margin-bottom: 4px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.preview-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    white-space: pre-wrap;
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: 12px;
}

.preview-placeholder svg {
    opacity: 0.3;
}

/* Responsive Layout */
@media (min-width: 768px) {
    .notes-list-panel {
        width: 40%;
        border-right: 1px solid var(--divider);
    }

    .preview-panel {
        display: flex;
        width: 60%;
    }

    .resize-handle {
        display: none;
    }
}

@media (max-width: 767px) {
    .file-manager-content {
        flex-direction: column;
    }

    .notes-list-panel {
        height: 45%;
        min-height: 150px;
    }

    .resize-handle {
        display: block;
    }

    .preview-panel {
        display: flex;
        height: 55%;
        min-height: 150px;
    }
}
