/*
 * BrainyCP File Manager
 * Adaptive theme - inherits colors from parent admin template
 * Override CSS variables in parent template to customize
 */
:root {
    --fm-primary: var(--admin-primary, #0f172a);
    --fm-primary-dark: #020617;
    --fm-accent: var(--admin-accent, #3b82f6);
    --fm-accent-hover: #2563eb;
    --fm-accent-light: rgba(59, 130, 246, 0.1);
    --fm-success: var(--admin-success, #10b981);
    --fm-danger: var(--admin-danger, #ef4444);
    --fm-danger-hover: #dc2626;
    --fm-warning: var(--admin-warning, #f59e0b);
    --fm-bg: var(--admin-bg, #f8fafc);
    --fm-surface: var(--admin-surface, #ffffff);
    --fm-surface-alt: var(--admin-surface-alt, #f1f5f9);
    --fm-border: var(--admin-border, #e2e8f0);
    --fm-border-light: #f1f5f9;
    --fm-text: var(--admin-text, #1e293b);
    --fm-text-muted: var(--admin-text-muted, #64748b);
    --fm-text-dim: #94a3b8;
    --fm-hover: var(--admin-hover, #f1f5f9);
    --fm-selected: var(--admin-selected, #eff6ff);
    --fm-radius: var(--admin-radius, 8px);
    --fm-radius-sm: 6px;
    --fm-shadow: var(--admin-shadow, 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1));
    --fm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --fm-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --fm-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --fm-font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, Consolas, monospace;
    --fm-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--fm-font-sans);
    background: var(--fm-bg);
    color: var(--fm-text);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.7);
}

/* Container */
.fm-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--fm-bg);
}



/* Main layout */
.fm-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Panel */
.fm-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--fm-surface);
    border-right: 1px solid var(--fm-border);
    min-width: 0;
    transition: var(--fm-transition);
}

.fm-panel:last-child {
    border-right: none;
}

.fm-panel.active {
    background: var(--fm-surface);
    box-shadow: inset 0 2px 0 var(--fm-accent);
}

.fm-panel:not(.active) {
    background: #f8fafc;
}

.fm-panel:not(.active) .fm-file-list {
    opacity: 0.9;
}

/* Panel header */
.fm-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--fm-surface);
    border-bottom: 1px solid var(--fm-border);
}

.fm-badge {
    background: linear-gradient(135deg, var(--fm-accent) 0%, #2563eb 100%);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--fm-radius-sm);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}

.fm-username {
    font-weight: 600;
    font-size: 13px;
    color: var(--fm-text);
}

.fm-path-input {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    font-size: 12px;
    font-family: var(--fm-font-mono);
    background: var(--fm-surface-alt);
    color: var(--fm-text);
    transition: var(--fm-transition);
}

.fm-path-input:focus {
    outline: none;
    border-color: var(--fm-accent);
    background: var(--fm-surface);
    box-shadow: 0 0 0 3px var(--fm-accent-light);
}

.fm-btn-refresh {
    width: 32px;
    height: 32px;
    border: 1px solid var(--fm-border);
    background: var(--fm-surface-alt);
    color: var(--fm-text-muted);
    border-radius: var(--fm-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--fm-transition);
}

.fm-btn-refresh:hover {
    background: var(--fm-surface);
    color: var(--fm-accent);
    border-color: var(--fm-border);
    box-shadow: var(--fm-shadow);
}

/* Toolbar */
.fm-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    background: var(--fm-surface-alt);
    border-bottom: 1px solid var(--fm-border);
}

.fm-tool-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--fm-text-muted);
    border-radius: var(--fm-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--fm-transition);
}

.fm-tool-btn:hover {
    background: var(--fm-surface);
    color: var(--fm-text);
    border-color: var(--fm-border);
    box-shadow: var(--fm-shadow);
}

.fm-tool-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Filter bar */
.fm-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--fm-surface);
    border-bottom: 1px solid var(--fm-border);
}

.fm-filter-bar svg {
    color: var(--fm-text-dim);
    flex-shrink: 0;
}

.fm-filter-input {
    flex: 1;
    padding: 5px 10px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    background: var(--fm-surface-alt);
    color: var(--fm-text);
    font-size: 12px;
    outline: none;
    transition: var(--fm-transition);
}

.fm-filter-input:focus {
    border-color: var(--fm-accent);
}

.fm-filter-input::placeholder {
    color: var(--fm-text-dim);
}

/* File list */
.fm-list-header {
    display: grid;
    grid-template-columns: 24px 1fr 60px 85px 120px 50px;
    gap: 8px;
    padding: 8px 12px;
    background: var(--fm-surface-alt);
    border-bottom: 1px solid var(--fm-border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fm-text-muted);
    user-select: none;
}

.fm-list-header span {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--fm-transition);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-list-header span:hover {
    color: var(--fm-accent);
}

.fm-file-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.fm-file-item {
    display: grid;
    grid-template-columns: 24px 1fr 60px 85px 120px 50px;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--fm-border-light);
    align-items: center;
    cursor: pointer;
    transition: var(--fm-transition);
    font-size: 12px;
}

.fm-file-item:hover {
    background: var(--fm-hover);
}

.fm-file-item.selected {
    background: var(--fm-selected);
    border-bottom-color: rgba(59, 130, 246, 0.2);
}

.fm-file-item.cut {
    opacity: 0.5;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        rgba(233, 69, 96, 0.08) 4px,
        rgba(233, 69, 96, 0.08) 8px
    );
    border-left: 3px solid var(--fm-accent);
}

.fm-file-item.go-up {
    font-weight: 500;
    color: var(--fm-text-dim);
    border-bottom: 1px solid var(--fm-border);
}

.fm-file-item.go-up:hover {
    color: var(--fm-text);
    background: var(--fm-hover);
}

.fm-file-item.go-up .fm-file-icon svg {
    fill: var(--fm-text-dim);
}

.fm-file-item.drag-over {
    background: var(--fm-selected);
    outline: 2px dashed var(--fm-accent);
    outline-offset: -2px;
}

.fm-file-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--fm-accent);
}

.fm-file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.fm-file-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-file-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fm-file-icon svg {
    width: 18px;
    height: 18px;
}

.fm-file-type,
.fm-file-date,
.fm-file-perms {
    font-size: 11px;
    color: var(--fm-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-file-size {
    font-size: 11px;
    color: var(--fm-text-muted);
    text-align: right;
    font-family: var(--fm-font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Panel footer */
.fm-panel-footer {
    padding: 6px 14px;
    background: var(--fm-surface-alt);
    border-top: 1px solid var(--fm-border);
    font-size: 11px;
    color: var(--fm-text-muted);
    display: flex;
    gap: 16px;
}

.fm-panel-footer strong {
    color: var(--fm-text);
}

.fm-panel.active .fm-panel-footer {
    background: var(--fm-surface);
}

/* Bottom bar - full width */
.fm-bottom-bar {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--fm-surface-alt);
    border-top: 1px solid var(--fm-border);
    font-size: 12px;
    color: var(--fm-text-muted);
}

.fm-bottom-info {
    display: flex;
    gap: 16px;
    padding: 6px 16px;
    border-bottom: 1px solid var(--fm-border);
    font-size: 11px;
}

.fm-bottom-info strong {
    color: var(--fm-text);
}

.fm-bottom-actions {
    display: flex;
    gap: 3px;
    padding: 3px 6px;
    flex-wrap: wrap;
    background: var(--fm-surface);
}

.fm-bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    background: var(--fm-surface-alt);
    color: var(--fm-text);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: var(--fm-transition);
    white-space: nowrap;
}

.fm-bottom-btn:hover:not([disabled]) {
    background: var(--fm-accent);
    color: #fff;
    border-color: var(--fm-accent);
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.fm-bottom-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* File tabs bar (bottom) */
.fm-editor-tabs-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--fm-surface-alt);
    border-bottom: 1px solid var(--fm-border);
    overflow-x: auto;
    scrollbar-width: thin;
    min-height: 38px;
}

.fm-editor-tabs-bar:empty {
    display: none;
}

.fm-tabs-label {
    font-size: 11px;
    color: var(--fm-text-muted);
    margin-right: 6px;
    white-space: nowrap;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fm-tab-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    background: var(--fm-surface);
    color: var(--fm-text);
    font-size: 12px;
    cursor: pointer;
    transition: var(--fm-transition);
    white-space: nowrap;
    user-select: none;
}

.fm-tab-item:hover {
    background: var(--fm-hover);
    border-color: var(--fm-accent);
    color: var(--fm-accent);
}

.fm-tab-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.fm-tab-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    font-weight: 500;
}

.fm-tab-item-modified {
    color: var(--fm-warning);
    font-weight: bold;
    font-size: 12px;
    line-height: 1;
}

.fm-tab-item-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    color: var(--fm-text-muted);
    transition: var(--fm-transition);
    margin-left: 2px;
}

.fm-tab-item-close:hover {
    background: var(--fm-danger);
    color: #fff;
}

/* Modal Overlay & Modal */
.fm-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fmFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fmSlideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fm-modal {
    background: var(--fm-surface);
    border-radius: var(--fm-radius);
    box-shadow: var(--fm-shadow-lg);
    max-width: 520px;
    width: 90%;
    border: 1px solid var(--fm-border);
    animation: fmSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.fm-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--fm-border);
    font-weight: 700;
    font-size: 15px;
    color: var(--fm-text);
    background: var(--fm-surface-alt);
}

.fm-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 70vh;
}

.fm-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--fm-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--fm-surface-alt);
}

.fm-input {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    font-size: 13px;
    font-family: var(--fm-font-sans);
    background: var(--fm-surface);
    color: var(--fm-text);
    transition: var(--fm-transition);
}

.fm-input:focus {
    outline: none;
    border-color: var(--fm-accent);
    box-shadow: 0 0 0 3px var(--fm-accent-light);
}

.fm-btn {
    padding: 8px 18px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: var(--fm-surface);
    color: var(--fm-text);
    transition: var(--fm-transition);
}

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

.fm-btn-primary {
    background: var(--fm-accent);
    color: #fff;
    border-color: var(--fm-accent);
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

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

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

.fm-btn-primary:hover {
    opacity: 0.9;
}

.fm-btn-danger {
    background: var(--fm-danger);
    color: #fff;
    border-color: var(--fm-danger);
}

.fm-btn-danger:hover {
    opacity: 0.9;
}

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

.fm-btn-success:hover {
    opacity: 0.9;
}

/* Context menu */
.fm-context-menu {
    position: fixed;
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 2000;
    min-width: 180px;
    padding: 4px 0;
    user-select: none;
}

.fm-context-item {
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.1s;
}

.fm-context-item:hover {
    background: var(--fm-hover);
}

.fm-context-item svg {
    width: 14px;
    height: 14px;
    fill: var(--fm-text-muted);
}

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

.fm-context-item.danger svg {
    fill: var(--fm-danger);
}

.fm-context-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Editor tabs */
.fm-editor-tabs {
    display: flex;
    background: var(--fm-surface-alt);
    border-bottom: 1px solid var(--fm-border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.fm-editor-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-right: 1px solid var(--fm-border);
    cursor: pointer;
    font-size: 12px;
    color: var(--fm-text-muted);
    background: var(--fm-surface-alt);
    white-space: nowrap;
    transition: all 0.15s;
    min-width: 100px;
    max-width: 200px;
}

.fm-editor-tab:hover {
    background: var(--fm-hover);
}

.fm-editor-tab.active {
    background: var(--fm-surface);
    color: var(--fm-text);
    border-bottom: 2px solid var(--fm-accent);
}

.fm-editor-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.fm-editor-tab-modified {
    color: var(--fm-warning);
    font-weight: bold;
}

.fm-editor-tab-close {
    padding: 0 2px;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1;
    opacity: 0.5;
}

.fm-editor-tab-close:hover {
    background: var(--fm-danger);
    color: #fff;
    opacity: 1;
}

/* Editor overlay */
.fm-editor-overlay .fm-editor-modal {
    max-width: 95vw;
    max-height: 95vh;
    width: 95vw;
    height: 95vh;
    display: flex;
    flex-direction: column;
}

.fm-editor-overlay .fm-modal-body,
.fm-editor-overlay .fm-modal-footer,
.fm-editor-overlay .fm-modal-header {
    display: none !important;
}

/* Editor topbar */
.fm-editor-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--fm-surface-alt);
    border-bottom: 1px solid var(--fm-border);
    min-height: 36px;
}

.fm-editor-topbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fm-editor-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-editor-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: var(--fm-radius);
    background: transparent;
    color: var(--fm-text);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.fm-editor-btn:hover {
    background: var(--fm-hover);
    border-color: var(--fm-border);
}

.fm-editor-btn.active {
    background: var(--fm-accent);
    color: #fff;
}

.fm-editor-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.fm-editor-btn svg {
    fill: currentColor;
}

.fm-editor-separator {
    width: 1px;
    height: 20px;
    background: var(--fm-border);
    margin: 0 4px;
}

.fm-editor-select {
    padding: 3px 6px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    background: var(--fm-surface);
    color: var(--fm-text);
    font-size: 11px;
}

.fm-editor-close {
    color: var(--fm-danger) !important;
}

.fm-editor-close:hover {
    background: var(--fm-danger) !important;
    color: #fff !important;
}

/* Editor body */
.fm-editor-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.fm-editor-container {
    width: 100%;
    height: 100%;
}

.fm-editor-container .CodeMirror {
    height: 100%;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Editor statusbar */
.fm-editor-statusbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 12px;
    background: var(--fm-surface-alt);
    border-top: 1px solid var(--fm-border);
    font-size: 11px;
    color: var(--fm-text-muted);
    min-height: 24px;
}

.fm-editor-statusbar span {
    white-space: nowrap;
}

.fm-editor-statusbar-btn {
    margin-left: auto;
    padding: 2px 4px;
    border: none;
    background: transparent;
    color: var(--fm-text-muted);
    cursor: pointer;
    border-radius: 3px;
}

.fm-editor-statusbar-btn:hover {
    background: var(--fm-hover);
    color: var(--fm-text);
}

/* Fullscreen */
.fm-editor-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    z-index: 10000 !important;
}

/* CodeMirror overrides - custom syntax highlighting */
.CodeMirror {
    background: #1e1e2e !important;
    color: #cdd6f4 !important;
}

.CodeMirror-linenumber {
    color: #585b70 !important;
}

.CodeMirror-cursor {
    border-left: 2px solid #f5e0dc !important;
}

.CodeMirror-selected {
    background: #45475a !important;
}

.CodeMirror-focused .CodeMirror-selected {
    background: #585b70 !important;
}

.CodeMirror-line::selection,
.CodeMirror-line > span::selection,
.CodeMirror-line > span > span::selection {
    background: #585b70 !important;
}

.CodeMirror-activeline-background {
    background: #313244 !important;
}

/* Syntax colors - Catppuccin Mocha inspired */
.cm-keyword { color: #cba6f7 !important; font-weight: bold; }
.cm-atom { color: #fab387 !important; }
.cm-number { color: #fab387 !important; }
.cm-def { color: #89b4fa !important; }
.cm-variable { color: #cdd6f4 !important; }
.cm-variable-2 { color: #f38ba8 !important; }
.cm-variable-3, .cm-type { color: #f9e2af !important; }
.cm-property { color: #89dceb !important; }
.cm-operator { color: #94e2d5 !important; }
.cm-comment { color: #6c7086 !important; font-style: italic; }
.cm-string { color: #a6e3a1 !important; }
.cm-string-2 { color: #a6e3a1 !important; }
.cm-meta { color: #f5c2e7 !important; }
.cm-bracket { color: #cdd6f4 !important; }
.cm-tag { color: #cba6f7 !important; }
.cm-attribute { color: #f9e2af !important; }
.cm-builtin { color: #cba6f7 !important; }
.cm-qualifier { color: #f9e2af !important; }
.cm-error { color: #f38ba8 !important; }

/* PHP specific */
.cm-s-default .cm-tag { color: #cba6f7 !important; }
.cm-s-default .cm-attribute { color: #f9e2af !important; }

/* HTML */
.cm-tag.cm-bracket { color: #9399b2 !important; }

/* Search highlight */
.CodeMirror-search-match {
    background: rgba(249, 226, 175, 0.3) !important;
    outline: 1px solid rgba(249, 226, 175, 0.5) !important;
}

.CodeMirror-selected-match {
    background: rgba(250, 179, 135, 0.4) !important;
}

/* Search/Replace inline bar */
.fm-search-dialog {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 100;
    background: var(--fm-surface);
    border-bottom: 1px solid var(--fm-border);
    border-left: 1px solid var(--fm-border);
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 380px;
    font-size: 12px;
    border-radius: 0 0 0 var(--fm-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fm-search-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fm-search-row input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    background: var(--fm-surface-alt);
    color: var(--fm-text);
    font-size: 12px;
    outline: none;
}

.fm-search-row input:focus {
    border-color: var(--fm-accent);
}

.fm-search-row label {
    font-size: 11px;
    color: var(--fm-text-dim);
    min-width: 55px;
}

.fm-search-hint {
    font-size: 10px;
    color: var(--fm-text-dim);
    opacity: 0.7;
}

.fm-search-btns {
    display: flex;
    align-items: center;
    gap: 2px;
}

.fm-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    background: var(--fm-surface);
    color: var(--fm-text);
    font-size: 11px;
    cursor: pointer;
    transition: var(--fm-transition);
    min-width: 26px;
    height: 24px;
}

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

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

.fm-search-counter {
    font-size: 10px;
    color: var(--fm-text-dim);
    padding: 0 4px;
}

.fm-search-close {
    padding: 3px 5px;
    border: none;
    background: transparent;
    color: var(--fm-text-dim);
    cursor: pointer;
    font-size: 14px;
}

.fm-search-close:hover {
    color: var(--fm-danger);
}

.fm-search-options {
    display: flex;
    gap: 2px;
}

.fm-search-opt {
    padding: 2px 5px;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    background: var(--fm-surface);
    color: var(--fm-text-dim);
    font-size: 10px;
    cursor: pointer;
    transition: var(--fm-transition);
}

.fm-search-opt.active {
    background: var(--fm-accent);
    color: #fff;
    border-color: var(--fm-accent);
}

.fm-search-highlight {
    background: rgba(249, 226, 175, 0.3);
    outline: 1px solid rgba(249, 226, 175, 0.5);
}

.fm-search-current {
    background: rgba(250, 179, 135, 0.5);
}

/* Fold gutter */
.CodeMirror-foldmarker {
    color: #89b4fa !important;
    text-shadow: none;
}

.CodeMirror-foldgutter {
    width: 16px;
}

.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
    cursor: pointer;
}

.CodeMirror-foldgutter-open::after {
    content: "\25BE";
    color: #6c7086;
}

.CodeMirror-foldgutter-folded::after {
    content: "\25B8";
    color: #89b4fa;
}

/* Upload area */
.fm-upload-area {
    border: 2px dashed var(--fm-border);
    border-radius: var(--fm-radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.fm-upload-area:hover,
.fm-upload-area.dragover {
    border-color: var(--fm-accent);
    background: var(--fm-selected);
}

.fm-upload-area svg {
    width: 40px;
    height: 40px;
    fill: var(--fm-text-muted);
    margin-bottom: 10px;
}

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

.fm-toast {
    padding: 10px 16px;
    border-radius: var(--fm-radius);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.fm-toast.success { background: var(--fm-success); }
.fm-toast.error { background: var(--fm-danger); }
.fm-toast.info { background: var(--fm-accent); }

.fm-toast-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
}

.fm-toast-close:hover {
    opacity: 1;
}

/* Empty state */
.fm-empty {
    padding: 50px;
    text-align: center;
    color: var(--fm-text-muted);
    font-size: 13px;
}

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

/* Search results */
.fm-search-item:hover {
    background: var(--fm-hover);
}

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

/* Responsive */
@media (max-width: 768px) {
    .fm-main { flex-direction: column; }
    .fm-list-header,
    .fm-file-item {
        grid-template-columns: 30px 1fr 70px 80px;
    }
    .fm-file-type,
    .fm-file-perms { display: none; }
}
