/* Main container wrapper */
.fv-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Main container */
#framework-visualiser-graph {
    position: relative;
    flex: 1 1 auto;
    background-color: #f9f9f9;
    border-radius: 6px;
    /* Default dimensions - can be overridden by inline styles if needed */
    height: 100%;
    width: 100%;
}

/* Main view reposition button */
.fv-reposition-btn {
    position: absolute;
    top: 10px;
    right: 65px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #cccccc;
    border-radius: 4px 0 0 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #333333;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fv-reposition-btn:hover {
    background-color: #ffffff;
    color: #4BC716;
    border-color: #4BC716;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.fv-reposition-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Expand button - adjusted to connect with reposition button */
.fv-expand-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #cccccc;
    border-radius: 0 4px 4px 0;
    border-left: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #333333;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fv-expand-btn:hover {
    background-color: #ffffff;
    border-color: #999999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.fv-expand-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* When only expand button is shown, give it full border radius */
.fv-container:not(:has(.fv-reposition-btn)) .fv-expand-btn {
    border-radius: 4px;
    border-left: 1px solid #cccccc;
}

/* When only reposition button is shown, give it full border radius */
.fv-container:not(:has(.fv-expand-btn)) .fv-reposition-btn {
    border-radius: 4px;
    right: 10px;
}

/* Lightbox overlay */
.fv-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fv-fadeIn 0.3s ease;
}

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

/* Lightbox content */
.fv-lightbox-content {
    position: relative;
    width: 95vw;
    height: 95vh;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fv-slideIn 0.3s ease;
    overflow: hidden;
}

@keyframes fv-slideIn {
    from { 
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Lightbox network graph */
.fv-lightbox-graph {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Lightbox close button */
.fv-lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 10001;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #cccccc;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.fv-lightbox-close:hover {
    background-color: #ffffff;
    color: #333333;
    border-color: #999999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.fv-lightbox-close:active {
    transform: scale(0.95);
}

/* Lightbox reset button */
.fv-lightbox-reset {
    position: absolute;
    top: 15px;
    right: 75px;
    z-index: 10001;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #cccccc;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.fv-lightbox-reset:hover {
    background-color: #ffffff;
    color: #4BC716;
    border-color: #4BC716;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.fv-lightbox-reset:active {
    transform: translateY(0);
}

/* Prevent body scroll when lightbox is open */
body.fv-lightbox-open {
    overflow: hidden;
}

/* Disable default vis.js tooltip */
.vis-tooltip {
    display: none !important;
    visibility: hidden !important;
}

/* Custom info box (tooltip replacement) */
.fv-info-box {
    position: absolute;
    display: none;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    color: black;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1001;
    max-width: 300px;
    font-family: sans-serif;
    font-size: 12px;
    text-align: left;
    white-space: normal;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Lightbox info box styling */
.fv-lightbox .fv-info-box {
    background-color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid #dddddd;
}

.fv-info-box strong {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #000000;
}

.fv-lightbox .fv-info-box strong {
    font-size: 15px;
}

.fv-info-box hr {
    border: none;
    border-top: 1px solid #cccccc;
    margin: 4px 0;
}

/* Cursor styles for container */
#framework-visualiser-graph,
.fv-lightbox-graph {
    cursor: default;
}

#framework-visualiser-graph.node-hover-clickable,
.fv-lightbox-graph.node-hover-clickable {
    cursor: pointer;
}

#framework-visualiser-graph.node-hover-broken,
.fv-lightbox-graph.node-hover-broken {
    cursor: not-allowed;
}

/* Error message styling */
#framework-visualiser-graph .fv-error,
.fv-lightbox-graph .fv-error {
    color: red;
    padding: 10px;
}

#framework-visualiser-graph .fv-error pre,
.fv-lightbox-graph .fv-error pre {
    margin-top: 10px;
    padding: 10px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow-x: auto;
}

/* Navigation buttons */
.vis-navigation button {
    color: #000000;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 4px;
    padding: 6px 12px;
    margin: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vis-navigation button:hover {
    background-color: #f0f0f0;
    border-color: #999999;
}

/* Enhanced navigation buttons in lightbox */
.fv-lightbox .vis-navigation button {
    padding: 8px 14px;
    font-size: 14px;
}

/* Context menu */
.vis-context-menu {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #cccccc;
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.vis-context-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vis-context-menu li {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.vis-context-menu li:hover {
    background-color: #f0f0f0;
}

/* Loading bar */
#fv-loadingBar {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 0%;
    height: 5px;
    background-color: #4BC716;
    border-radius: 3px;
    z-index: 30;
    transition: width 0.3s ease;
}

/* === VIS.JS NETWORK STYLING === */

/* Default node styles */
.vis-node {
    font-family: arial, sans-serif;
    font-size: 12px;
    color: #000000;
}

/* Node label background for better readability */
.vis-node .vis-label {
    background-color: rgba(255, 255, 255, 0.8) !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

/* Default node dot styles */
.vis-node.vis-dot {
    border-width: 1px !important;
    border-color: #cccccc !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Selected node styles */
.vis-node.vis-dot.vis-selected {
    border-width: 2px !important;
}

/* Node hover styles */
.vis-node.vis-dot:hover {
    border-color: #4BC716 !important;
    background-color: #4BC716 !important;
}

/* Node highlight styles */
.vis-node.vis-dot.vis-hover {
    border-color: #cccccc !important;
    background-color: #e0e0e0 !important;
}

/* Lightbox nodes - larger size */
.fv-lightbox .vis-node {
    font-size: 14px;
}

/* Default edge styles */
.vis-edge {
    color: #666666 !important;
}

/* Edge hover styles */
.vis-edge:hover {
    color: #A5DE7A !important;
}

/* Edge highlight styles */
.vis-edge.vis-selected {
    color: #6E8C61 !important;
}

/* Lightbox edges - thicker */
.fv-lightbox .vis-edge {
    stroke-width: 1.5px !important;
}

/* Arrow styles */
.vis-edge .vis-arrow {
    fill: #666666 !important;
}

.vis-edge:hover .vis-arrow {
    fill: #A5DE7A !important;
}

.vis-edge.vis-selected .vis-arrow {
    fill: #6E8C61 !important;
}

/* === GROUP-SPECIFIC STYLES === */

/* Published group (default) */
.vis-group-published .vis-node.vis-dot {
    border-color: #cccccc !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Broken group */
.vis-group-broken .vis-node {
    font-size: 11px; /* Smaller text for broken nodes */
}

.vis-group-broken .vis-node.vis-dot {
    border-color: #576052 !important;
    background-color: #576052 !important;
    color: #536A48 !important;
}

.fv-lightbox .vis-group-broken .vis-node {
    font-size: 13px; /* Slightly larger in lightbox */
}

/* Framework instruction group */
.vis-group-tag-framework-instruction .vis-node.vis-dot {
    border-color: #D9F9AE !important;
    background-color: #D9F9AE !important;
    color: #D9F9AE !important;
}

.vis-group-tag-framework-instruction .vis-node.vis-dot:hover {
    background-color: #ffffff !important;
}

/* Framework claim group */
.vis-group-tag-framework-claim .vis-node.vis-dot {
    border-color: #D9F9AE !important;
    background-color: #D9F9AE !important;
    color: #D9F9AE !important;
}

.vis-group-tag-framework-claim .vis-node.vis-dot:hover {
    background-color: #ffffff !important;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .fv-lightbox-content {
        width: 98vw;
        height: 98vh;
        border-radius: 4px;
    }
    
    .fv-expand-btn {
        padding: 6px 10px;
        font-size: 14px;
        top: 8px;
        right: 8px;
    }
    
    .fv-reposition-btn {
        padding: 6px 8px;
        font-size: 10px;
        top: 8px;
        right: 50px;
    }
    
    .fv-lightbox-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 10px;
        right: 15px;
    }
    
    .fv-lightbox-reset {
        padding: 6px 12px;
        font-size: 12px;
        top: 10px;
        right: 55px;
        height: 35px;
    }
    
    .fv-info-box {
        max-width: 250px;
        font-size: 11px;
    }
    
    .fv-lightbox .fv-info-box {
        font-size: 13px;
        max-width: 280px;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .fv-expand-btn,
    .fv-lightbox-close {
        border-width: 0.5px;
    }
}

/* Focus styles for accessibility */
.fv-expand-btn:focus,
.fv-reposition-btn:focus,
.fv-lightbox-close:focus,
.fv-lightbox-reset:focus {
    outline: 2px solid #4BC716;
    outline-offset: 2px;
}

/* Animation for buttons on container hover */
.fv-container:hover .fv-expand-btn,
.fv-container:hover .fv-reposition-btn {
    opacity: 1;
    transform: scale(1.02);
}

.fv-expand-btn,
.fv-reposition-btn {
    opacity: 0.8;
    transition: all 0.2s ease;
}

/* Ensure lightbox appears above everything */
.fv-lightbox {
    z-index: 999999;
}

/* Additional vis.js overrides for better lightbox experience */
.fv-lightbox .vis-network {
    outline: none;
}

.fv-lightbox .vis-navigation {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 5px;
}

/* Zoom limit feedback for admin preview */
.fw-zoom-limit-reached {
    background-color: #ff6b6b !important;
    color: white !important;
    border-color: #ff5252 !important;
    animation: fw-zoom-limit-pulse 0.5s ease;
}

@keyframes fw-zoom-limit-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Ensure zoom buttons maintain their styling when limit is reached */
.fw-btn-zoom.fw-zoom-limit-reached {
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3) !important;
}

/* Alternative approach for vis.js node labels */
.vis-network canvas {
    /* This will affect the canvas rendering */
}

/* Try targeting the text elements directly */
.vis-network .vis-manipulation div,
.vis-network .vis-edit-mode div {
    background-color: rgba(255, 255, 255, 0.8) !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}