/* Graph Widget Styles */
.graph-widget-container {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 300px;
    height: 250px;
    background: var(--md-default-bg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow: hidden;
}

.graph-widget-container.collapsed {
    height: 45px;
}

.graph-widget-container.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 90vh;
    max-width: none;
    max-height: none;
    z-index: 9999;
    border: 2px solid var(--md-primary-fg-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.graph-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--md-primary-fg-color);
    color: var(--md-primary-bg-color);
    font-size: 12px;
    font-weight: 500;
    cursor: move;
}

.graph-widget-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.graph-widget-controls {
    display: flex;
    gap: 4px;
}

.graph-widget-btn {
    background: none;
    border: none;
    color: var(--md-primary-bg-color);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.graph-widget-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.graph-widget-btn .material-icons {
    font-size: 16px;
}

.graph-widget-content {
    width: 100%;
    height: calc(100% - 45px);
    overflow: hidden;
    position: relative;
}

#graph-widget-svg {
    width: 100%;
    height: 100%;
}

/* Graph elements */
.graph-widget .node {
    cursor: pointer;
    stroke: var(--md-default-bg-color);
    stroke-width: 1.5px;
    transition: all 0.2s;
}

.graph-widget .node:hover {
    stroke-width: 2px;
    filter: brightness(1.2);
}

.graph-widget .link {
    stroke: var(--md-default-fg-color--light);
    stroke-opacity: 0.6;
    stroke-width: 1px;
}

.graph-widget .node-label {
    font-size: 9px;
    font-family: var(--md-text-font);
    pointer-events: none;
    text-anchor: middle;
    fill: var(--md-default-fg-color);
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 500;
}

.graph-widget-container:not(.collapsed) .node-label {
    opacity: 1;
}

.graph-widget-container.expanded .node-label {
    font-size: 11px;
    opacity: 1;
}

/* Tooltip */
.graph-widget-tooltip {
    position: absolute;
    background: var(--md-tooltip-bg-color, rgba(0, 0, 0, 0.9));
    color: var(--md-tooltip-fg-color, white);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1001;
    max-width: 200px;
    word-wrap: break-word;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .graph-widget-container {
        width: 250px;
        height: 200px;
        right: 10px;
        top: 60px;
    }

    .graph-widget-container.expanded {
        width: 95vw;
        height: 70vh;
    }
}

@media (max-width: 480px) {
    .graph-widget-container {
        width: 200px;
        height: 150px;
    }

    .graph-widget-title {
        display: none;
    }
}

/* Dark theme adjustments */
[data-md-color-scheme="slate"] .graph-widget-container {
    background: var(--md-default-bg-color);
    border-color: var(--md-default-fg-color--lightest);
}

[data-md-color-scheme="slate"] .graph-widget .link {
    stroke: #64748b;
    stroke-opacity: 0.8;
}

[data-md-color-scheme="slate"] .graph-widget .node-label {
    fill: var(--md-default-fg-color);
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

[data-md-color-scheme="slate"] .graph-widget .node {
    stroke: var(--md-default-bg-color);
    stroke-width: 2px;
}

/* Animation for initial load */
.graph-widget-container {
    animation: slideInFromRight 0.5s ease-out;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}
