/* Knowledge Map Styles */
#knowledge-map {
    width: 100%;
    height: 600px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #f8f9fa;
    position: relative;
}

#research-map {
    width: 100%;
    height: 600px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #f8f9fa;
    position: relative;
}

/* Cytoscape.js container styles */
.cytoscape-container {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Ensure knowledge map container allows floating elements */
#knowledge-map {
    position: relative;
    overflow: visible;
}

/* Node styles */
.cy-node {
    font-size: 12px;
    font-weight: 600;
    text-outline-width: 2px;
    text-outline-color: #fff;
    text-valign: center;
    text-halign: center;
    color: #333;
    text-wrap: wrap;
    text-max-width: 120px;
    text-overflow-wrap: anywhere;
}

/* Different node types */
.cy-node.undergraduate {
    background-color: #007bff;
    border-width: 2px;
    border-color: #0056b3;
    border-style: solid;
}

.cy-node.research {
    background-color: #28a745;
    border-width: 2px;
    border-color: #1e7e34;
    border-style: solid;
}

.cy-node.subject {
    background-color: #6f42c1;
    border-width: 2px;
    border-color: #5a2d91;
    border-style: solid;
}

.cy-node.skill {
    background-color: #fd7e14;
    border-width: 2px;
    border-color: #e55a00;
    border-style: solid;
}

.cy-node.concept {
    background-color: #20c997;
    border-width: 2px;
    border-color: #17a085;
    border-style: solid;
}

.cy-node.project {
    background-color: #dc3545;
    border-width: 2px;
    border-color: #c82333;
    border-style: solid;
}

.cy-node.publication {
    background-color: #6c757d;
    border-width: 2px;
    border-color: #545b62;
    border-style: solid;
}

/* Edge styles */
.cy-edge {
    width: 2px;
    line-color: #6c757d;
    target-arrow-color: #6c757d;
    target-arrow-shape: triangle;
    curve-style: bezier;
    control-point-distances: 20px;
    control-point-weights: 0.5;
}

.cy-edge.strong {
    width: 3px;
    line-color: #007bff;
    target-arrow-color: #007bff;
}

.cy-edge.weak {
    width: 1px;
    line-color: #adb5bd;
    target-arrow-color: #adb5bd;
}

/* Hover effects */
.cy-node:hover {
    opacity: 0.8;
    transition: all 0.2s ease;
}

.cy-edge:hover {
    opacity: 0.8;
    width: 4px;
    transition: all 0.2s ease;
}

/* Selected state */
.cy-node.selected {
    background-color: #ffc107 !important;
    border-color: #e0a800 !important;
    color: #212529 !important;
}

.cy-edge.selected {
    line-color: #ffc107 !important;
    target-arrow-color: #ffc107 !important;
    width: 4px !important;
}

/* Node highlight/glow effect */
.cy-node.highlighted {
    border-width: 6px !important;
    border-color: #ffc107 !important;
    box-shadow: 0 0 25px rgba(255, 193, 7, 1) !important;
    animation: glow 1s ease-in-out infinite alternate;
    z-index: 999 !important;
}

@keyframes glow {
    from {
        box-shadow: 0 0 25px rgba(255, 193, 7, 1) !important;
    }
    to {
        box-shadow: 0 0 35px rgba(255, 193, 7, 1) !important;
    }
}

/* Map controls */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.map-controls .btn {
    margin: 2px;
    padding: 5px 10px;
    font-size: 12px;
}

/* Legend */
.map-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 3px 0;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Loading spinner */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Responsive design */
@media (max-width: 768px) {
    #knowledge-map,
    #research-map {
        height: 400px;
    }
    
    .cy-node {
        font-size: 10px;
        text-max-width: 80px;
    }
    
    .map-controls,
    .map-legend {
        position: relative;
        margin: 10px 0;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Legend styles */
.legend-item {
    display: flex;
    align-items: center;
    padding: 0.25rem 0;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.legend-item span:last-child {
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
}

/* Filter button styles */
.filter-btn {
    transition: all 0.3s ease;
    border-radius: 0.375rem;
}

.filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-btn.active {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

/* Node card styles */
.node-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.node-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.node-card .card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.node-card:hover .card {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

.node-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.node-card .card-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0;
}

/* Node card category indicators */
.node-card[data-category="subject"] .card {
    border-left: 4px solid #6f42c1;
}

.node-card[data-category="skill"] .card {
    border-left: 4px solid #fd7e14;
}

.node-card[data-category="concept"] .card {
    border-left: 4px solid #20c997;
}

.node-card[data-category="method"] .card {
    border-left: 4px solid #ffc107;
}

.node-card[data-category="project"] .card {
    border-left: 4px solid #28a745;
}

/* Fullscreen styles */
#knowledge-map:fullscreen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    background: #ffffff;
    z-index: 9999;
}

#knowledge-map:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    background: #ffffff;
    z-index: 9999;
}

#knowledge-map:-moz-full-screen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    background: #ffffff;
    z-index: 9999;
}

#knowledge-map:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    background: #ffffff;
    z-index: 9999;
}

/* Fullscreen button styles */
#fullscreen-btn {
    transition: all 0.3s ease;
}

#fullscreen-btn:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* External map controls */
.map-controls-external {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
}

.map-controls-external .btn {
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.map-controls-external .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.map-controls-external .dropdown-menu {
    font-size: 0.875rem;
    min-width: 150px;
}