/* Operator Library Panel Styles */
/* TouchDesigner-style design following gatito-cheer specifications */

.operator-library-panel {
    position: relative;
    width: 280px;
    min-width: 200px;
    max-width: 400px;
    background: #1e1e1e;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
}

.operator-library-header {
    padding: 12px;
    border-bottom: 1px solid #333;
    background: #1e1e1e;
}

.operator-library-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 12px 0;
}

.operator-library-search {
    position: relative;
    width: 100%;
}

.operator-library-search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.operator-library-search-input:focus {
    border-color: #4a9eff;
}

.operator-library-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
    color: #888;
}

.operator-library-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.operator-library-content::-webkit-scrollbar {
    width: 8px;
}

.operator-library-content::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.operator-library-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.operator-library-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.operator-library-category {
    border-bottom: 1px solid #333;
}

.operator-library-category-header {
    height: 36px;
    background: #252525;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.operator-library-category-header:hover {
    background: #2a2a2a;
}

.operator-library-category-icon {
    font-size: 16px;
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.operator-library-category-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.operator-library-category-toggle {
    font-size: 10px;
    color: #888;
    transition: transform 0.2s;
}

.operator-library-category.expanded .operator-library-category-toggle {
    transform: rotate(90deg);
}

.operator-library-category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

.operator-library-category.expanded .operator-library-category-content {
    max-height: 2000px;
    transition: max-height 0.3s ease-in;
}

.operator-library-node-item {
    height: 48px;
    padding: 8px 12px;
    background: #252525;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    cursor: grab;
    user-select: none;
    transition: background 0.2s;
    position: relative;
}

.operator-library-node-item:hover {
    background: #2d2d2d;
}

.operator-library-node-item:active {
    cursor: grabbing;
    background: #353535;
}

.operator-library-node-item.dragging {
    opacity: 0.5;
    background: #353535;
}

.operator-library-node-icon {
    width: 24px;
    height: 24px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.operator-library-node-name {
    flex: 1;
    font-size: 13px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.operator-library-favorite-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    color: #666;
    transition: transform 0.2s, color 0.2s;
    margin-right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.operator-library-favorite-button:hover {
    transform: scale(1.2);
    color: #ffd700;
}

.operator-library-favorite-button:active {
    transform: scale(0.9);
}

.operator-library-favorite-button:focus {
    outline: none;
}

.operator-library-node-drag-handle {
    width: 16px;
    height: 16px;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 12px;
}

.operator-library-node-item:hover .operator-library-node-drag-handle {
    opacity: 1;
}

.operator-library-empty-state {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

.operator-library-no-results {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* Favorites and Recently Used sections */
.operator-library-favorites,
.operator-library-recently-used {
    border-bottom: 1px solid #333;
}

/* Error state */
.operator-library-error-state {
    padding: 24px;
    text-align: center;
    background: #2a2a2a;
    color: #fff;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.operator-library-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.operator-library-error-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #fff;
}

.operator-library-error-message {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 12px;
}

.operator-library-error-list {
    text-align: left;
    display: inline-block;
    margin: 12px 0;
    color: #e74c3c;
    list-style: none;
    padding: 0;
}

.operator-library-error-list li {
    margin: 4px 0;
    padding-left: 20px;
    position: relative;
}

.operator-library-error-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #e74c3c;
}

.operator-library-error-help {
    font-size: 13px;
    color: #888;
    margin: 16px 0;
    max-width: 400px;
}

.operator-library-error-reload {
    background: #4a9eff;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin: 16px 0;
    transition: background 0.2s;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.operator-library-error-reload:hover {
    background: #3a8eef;
}

.operator-library-error-reload:active {
    background: #2a7edf;
}

.operator-library-error-console {
    font-size: 12px;
    color: #666;
    margin-top: 16px;
}

/* Drag preview */
.operator-library-drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.8;
    background: #252525;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
}

.operator-library-drag-preview-icon {
    font-size: 20px;
}

.operator-library-drag-preview-name {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
}

/* Context Menu */
.operator-library-context-menu {
    background: #252525;
    border: 1px solid #444;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    min-width: 280px;
    max-width: 400px;
    max-height: 600px;
    overflow-y: auto;
    font-size: 12px;
}

.operator-library-context-menu-header {
    padding: 10px 12px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2a2a2a;
}

.operator-library-context-menu-icon {
    font-size: 14px;
}

.operator-library-context-menu-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.operator-library-context-menu-content {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.operator-library-context-menu-category {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.operator-library-context-menu-category-header {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.operator-library-context-menu-category-icon {
    font-size: 12px;
}

.operator-library-context-menu-category-name {
    font-size: 11px;
}

.operator-library-context-menu-category-nodes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding-left: 8px;
}

.operator-library-context-menu-item {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s;
    font-size: 12px;
}

.operator-library-context-menu-item:hover {
    background: #2d2d2d;
}

.operator-library-context-menu-item.selected {
    background: #3a3a3a;
    color: #4a9eff;
}

.operator-library-context-menu-item-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.operator-library-context-menu-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Flyout Card */
.operator-library-flyout-card {
    background: #252525;
    border: 1px solid #444;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    min-width: 300px;
    max-width: 400px;
    font-size: 12px;
    z-index: 10001;
}

.operator-library-flyout-header {
    padding: 10px 12px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2a2a2a;
}

.operator-library-flyout-icon {
    font-size: 16px;
}

.operator-library-flyout-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.operator-library-flyout-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.operator-library-flyout-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.operator-library-flyout-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.operator-library-flyout-section-content {
    font-size: 12px;
    color: #ccc;
    line-height: 1.5;
}

.operator-library-flyout-properties,
.operator-library-flyout-examples {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.operator-library-flyout-properties li,
.operator-library-flyout-examples li {
    padding-left: 12px;
    position: relative;
}

.operator-library-flyout-properties li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #4a9eff;
}

.operator-library-flyout-examples li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #51cf66;
}
