/* Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> */

/* --- Full Screen Overlay --- */
#graph-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.2s ease;
}

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

#graph-container {
    width: 90%;
    height: 90%;
    max-width: 1400px;
    max-height: 900px;
    background-color: var(--md-default-bg-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Close Button --- */
#graph-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--md-default-bg-color);
    color: var(--md-default-fg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#graph-close:hover {
    background-color: var(--md-accent-fg-color);
    color: var(--md-accent-bg-color);
    border-color: var(--md-accent-fg-color);
    transform: rotate(90deg);
}

/* --- Mini Graph --- */
#mini-graph-container {
    width: 100%;
    height: 200px;
    background-color: var(--md-default-bg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    border-radius: 4px;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

/* Mobile version of mini graph */
#mini-graph-container.mini-graph-mobile {
    margin-top: 2rem;
    margin-bottom: 2rem;
    height: 250px;
}

/* Responsive adjustments */
@media screen and (max-width: 76.1875em) {
    #mini-graph-container {
        height: 250px;
    }
}

@media screen and (max-width: 44.9375em) {
    #mini-graph-container {
        height: 200px;
    }

    #mini-graph-container.mini-graph-mobile {
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

#mini-graph-expand {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    border: none;
    color: var(--md-default-fg-color--light);
    cursor: pointer;
    z-index: 10;
    padding: 2px;
}

#mini-graph-expand:hover {
    color: var(--md-primary-fg-color);
}

/* --- Graph Elements --- */
.graph-node {
    fill: var(--md-default-fg-color--light);
    cursor: pointer;
    transition: all 0.2s ease;
    stroke: var(--md-default-bg-color);
    stroke-width: 1px;
}

.graph-node:hover {
    fill: var(--md-accent-fg-color);
    filter: drop-shadow(0 0 4px var(--md-accent-fg-color));
}

.graph-node.active {
    fill: var(--md-primary-fg-color);
    stroke: var(--md-primary-fg-color);
    stroke-width: 2px;
    filter: drop-shadow(0 0 6px var(--md-primary-fg-color));
}

.graph-link {
    stroke: var(--md-default-fg-color--lighter);
    stroke-opacity: 0.4;
    stroke-width: 1.5px;
    transition: all 0.2s ease;
}

.graph-link:hover {
    stroke-opacity: 0.8;
}

.graph-label {
    font-family: var(--md-text-font-family);
    font-size: 10px;
    fill: var(--md-default-fg-color);
    pointer-events: none;
    text-shadow:
        -1px -1px 0 var(--md-default-bg-color),
        1px -1px 0 var(--md-default-bg-color),
        -1px 1px 0 var(--md-default-bg-color),
        1px 1px 0 var(--md-default-bg-color);
    opacity: 1;
    transition: opacity 0.2s ease;
    user-select: none;
}

/* Better label visibility for dark mode */
[data-md-color-scheme="slate"] .graph-label {
    text-shadow:
        -1px -1px 1px rgba(0, 0, 0, 0.8),
        1px -1px 1px rgba(0, 0, 0, 0.8),
        -1px 1px 1px rgba(0, 0, 0, 0.8),
        1px 1px 1px rgba(0, 0, 0, 0.8);
}