/* Dracula-themed Explorer styles */
:root {
    --explorer-bg: #1e1f29;
    --explorer-fg: #f8f8f2;
    --explorer-comment: #6272a4;
    --explorer-selection: #44475a;
    --explorer-purple: #bd93f9;
    --explorer-cyan: #8be9fd;
    --explorer-green: #50fa7b;
    --explorer-yellow: #f1fa8c;
    --explorer-orange: #ffb86c;
    --explorer-pink: #ff79c6;
    --explorer-red: #ff5555;
}

/* Sidebar Custom Scrollbar */
#explorer-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

#explorer-container::-webkit-scrollbar-track {
    background: transparent;
}

#explorer-container::-webkit-scrollbar-thumb {
    background: rgba(98, 114, 164, 0.2);
    border-radius: 3px;
    transition: background 0.2s;
}

#explorer-container::-webkit-scrollbar-thumb:hover {
    background: rgba(98, 114, 164, 0.5);
}

.explorer-tree {
    padding: 8px 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    color: var(--explorer-fg);
    user-select: none;
}

/* Root collapsible sections */
.explorer-section {
    margin-bottom: 12px;
}

.explorer-section-header {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--explorer-comment);
    transition: color 0.2s ease;
    text-transform: uppercase;
}

.explorer-section-header:hover {
    color: #ffffff;
}

.section-toggle-icon {
    font-size: 14px;
    margin-right: 4px;
    color: var(--explorer-comment);
    transition: transform 0.2s ease, color 0.2s ease;
}

.explorer-section-header:hover .section-toggle-icon {
    color: #ffffff;
}

.explorer-section-title {
    flex: 1;
}

.explorer-section-count {
    font-size: 9px;
    background: rgba(98, 114, 164, 0.15);
    color: var(--explorer-comment);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.explorer-section-header:hover .explorer-section-count {
    background: rgba(98, 114, 164, 0.3);
    color: #ffffff;
}

.explorer-section-body {
    display: block;
    margin-top: 4px;
}

.explorer-section.collapsed .explorer-section-body {
    display: none;
}

/* Workspace Folders */
.explorer-workspace {
    margin-bottom: 2px;
}

.workspace-header {
    display: flex;
    align-items: center;
    padding: 5px 6px;
    cursor: pointer;
    border-radius: 4px;
    color: #d1d5db;
    transition: background 0.15s ease, color 0.15s ease;
}

.workspace-header:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
}

.workspace-icon {
    font-size: 15px;
    margin-right: 6px;
    color: var(--explorer-orange);
    transition: transform 0.15s ease;
}

/* Workspace service types brand colors */
.explorer-workspace.service-custom .workspace-icon {
    color: #94a3b8; /* Muted Slate Gray - Offline/Custom */
}

.explorer-workspace.service-crm .workspace-icon {
    color: #ff5555; /* Dracula Crimson Red - CRM */
}

.explorer-workspace.service-creator .workspace-icon {
    color: #bd93f9; /* Sleek Dracula Purple - Creator */
}

.explorer-workspace.service-books .workspace-icon {
    color: #50fa7b; /* Sleek Emerald Green - Books */
}

.explorer-workspace.service-flow .workspace-icon {
    color: #ffb86c; /* Sleek Bright Orange - Flow */
}

.workspace-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.workspace-actions {
    display: none;
    align-items: center;
    margin-left: 6px;
}

.workspace-header:hover .workspace-actions {
    display: flex;
}

.action-btn {
    font-size: 14px;
    color: var(--explorer-comment);
    cursor: pointer;
    margin-left: 6px;
    transition: color 0.15s ease, transform 0.1s ease;
    padding: 2px;
    border-radius: 3px;
}

.action-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.08);
}

.action-btn:active {
    transform: scale(0.95);
}

/* Files inside Workspace */
.workspace-files {
    padding-left: 12px;
    margin-left: 13px;
    border-left: 1px solid rgba(98, 114, 164, 0.15); /* Vertical guideline */
    display: block;
    margin-top: 1px;
}

.explorer-workspace.collapsed .workspace-files {
    display: none;
}

.explorer-file {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 1px;
    color: #bcbcbc;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
    border-left: 2px solid transparent;
}

.explorer-file:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #ffffff;
}

/* Active File State with Dracula gradient */
.explorer-file.active-file {
    background: linear-gradient(90deg, rgba(189, 147, 249, 0.15) 0%, rgba(189, 147, 249, 0.02) 100%) !important;
    border-left-color: var(--explorer-purple);
    color: #ffffff;
    font-weight: 500;
}

.file-icon {
    font-size: 15px;
    margin-right: 6px;
    color: var(--explorer-cyan);
    opacity: 0.85;
    transition: color 0.15s ease;
}

.explorer-file:hover .file-icon {
    opacity: 1;
}

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

/* Dirty State (Unsaved indicator) */
.dirty-mark {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--explorer-yellow);
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 0 4px var(--explorer-yellow);
}

.explorer-file.is-dirty .file-name {
    color: #eeeeee;
}

/* Connection indicator (green link badge) */
.file-connection {
    display: none;
    font-size: 13px !important;
    color: var(--explorer-green);
    margin-left: auto;
    margin-right: 2px;
    opacity: 0.9;
    text-shadow: 0 0 4px rgba(80, 250, 123, 0.4);
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.file-connection:hover {
    opacity: 1;
    transform: scale(1.15);
}

.explorer-file.is-connected .file-connection {
    display: inline-block;
}

/* File Hover Actions */
.file-actions {
    display: none;
    align-items: center;
    margin-left: auto;
}

.explorer-file:hover .file-actions {
    display: flex;
}

/* If active or connected, push actions slightly but keep layout intact */
.explorer-file.is-connected:hover .file-connection {
    display: none; /* Hide link icon on hover to show action buttons instead */
}

.file-action-btn {
    font-size: 14px;
    color: var(--explorer-comment);
    cursor: pointer;
    margin-left: 4px;
    transition: color 0.15s ease, background 0.15s, transform 0.1s ease;
    padding: 2px;
    border-radius: 3px;
}

.file-action-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.08);
}

.file-action-btn:active {
    transform: scale(0.95);
}

/* File type specific colors */
.explorer-file.temp-file .file-icon {
    color: var(--explorer-pink) !important;
}

.explorer-file.temp-file .file-name {
    font-style: italic;
    opacity: 0.8;
}

.explorer-file.markdown-file .file-icon {
    color: var(--explorer-green) !important;
}

.empty-workspace {
    font-size: 10px;
    color: var(--explorer-comment);
    padding: 4px 6px;
    font-style: italic;
}

/* Client groups and headers */
.explorer-client-group {
    margin-bottom: 6px;
    border-left: 2px solid rgba(139, 233, 253, 0.15);
    padding-left: 4px;
}

.client-header {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 11px;
    transition: background 0.15s ease, color 0.15s ease;
}

.client-header:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #ffffff;
}

.client-toggle-icon {
    font-size: 14px;
    margin-right: 4px;
    color: var(--explorer-comment);
}

.client-icon {
    font-size: 14px;
    margin-right: 6px;
    color: var(--explorer-cyan);
}

.client-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-count-badge {
    font-size: 9px;
    background: rgba(139, 233, 253, 0.1);
    color: var(--explorer-cyan);
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 500;
}

.client-actions {
    display: none;
    align-items: center;
    margin-left: auto;
}

.client-header:hover .client-actions {
    display: flex;
}

.client-header:hover .client-count-badge {
    display: none;
}

.client-workspaces {
    padding-left: 8px;
    display: block;
    margin-top: 2px;
}

.explorer-client-group.collapsed .client-workspaces {
    display: none;
}

/* Virtual Folders inside Workspace */
.explorer-folder {
    margin-bottom: 2px;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    color: #b0b3b8;
    transition: background 0.15s ease, color 0.15s ease;
    border-left: 2px solid transparent;
}

.folder-header:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #ffffff;
}

.folder-header.active-folder {
    background: linear-gradient(90deg, rgba(189, 147, 249, 0.15) 0%, rgba(189, 147, 249, 0.02) 100%) !important;
    border-left-color: var(--explorer-purple);
    color: #ffffff;
    font-weight: 500;
}

.folder-icon {
    font-size: 14px;
    margin-right: 6px;
    color: var(--explorer-yellow);
}

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

.folder-actions {
    display: none;
    align-items: center;
    margin-left: 6px;
}

.folder-header:hover .folder-actions {
    display: flex;
}

.folder-contents {
    padding-left: 10px;
    margin-left: 10px;
    border-left: 1px dashed rgba(98, 114, 164, 0.15);
    display: block;
    margin-top: 1px;
}

.explorer-folder.collapsed .folder-contents {
    display: none;
}

/* Chevron icons for collapsing/expanding workspaces and folders */
.chevron-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    margin-right: 2px;
    color: var(--explorer-comment);
    transition: transform 0.15s ease;
    user-select: none;
}

.workspace-header:hover .chevron-icon,
.folder-header:hover .chevron-icon {
    color: #ffffff;
}
