/* Advanced Knowledge Graph Styles */

.advanced-graph-container {
    position: relative;
    width: 100%;
    height: 600px;
    border: 2px solid rgba(224, 224, 224, 0.3);
    border-radius: 12px;
    background: linear-gradient(135deg, 
        rgba(245, 247, 250, 0.95) 0%, 
        rgba(195, 207, 226, 0.9) 25%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(240, 248, 255, 0.9) 75%,
        rgba(230, 240, 255, 0.95) 100%
    );
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    position: relative;
}

.advanced-graph-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(120, 200, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

#advanced-research-map {
    width: 100%;
    height: 100%;
    background: transparent;
    position: relative;
    z-index: 2;
}

.advanced-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 80%;
}

.advanced-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(221, 221, 221, 0.6);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-width: 60px;
}

.advanced-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.advanced-btn:hover::before {
    left: 100%;
}

.advanced-btn:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(0, 123, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(0, 123, 255, 0.8);
}

.advanced-btn:active {
    transform: translateY(0) scale(1.02);
    box-shadow: 
        0 4px 15px rgba(0, 123, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.advanced-legend {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    font-size: 12px;
    max-width: 320px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.advanced-legend h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.advanced-legend-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    padding: 4px 0;
    transition: all 0.2s ease;
    border-radius: 6px;
    padding-left: 8px;
    padding-right: 8px;
}

.advanced-legend-item:hover {
    background: rgba(0, 123, 255, 0.05);
    transform: translateX(5px);
}

.advanced-legend-color {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    margin-right: 12px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.advanced-legend-item:hover .advanced-legend-color {
    transform: scale(1.1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.advanced-info-panel {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    max-width: 320px;
    display: none;
    z-index: 1000;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    animation: slideInFromLeft 0.3s ease-out;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.advanced-info-panel h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid rgba(0, 123, 255, 0.2);
    padding-bottom: 8px;
}

.advanced-info-panel p {
    margin: 8px 0;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.advanced-info-panel p strong {
    color: #2c3e50;
    font-weight: 600;
}

.advanced-stats {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-size: 11px;
    color: #666;
}

/* Node highlighting */
.highlighted {
    opacity: 0.3 !important;
    transition: opacity 0.3s ease;
}

/* Beautiful animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.advanced-graph-container {
    animation: fadeInUp 0.8s ease-out;
}

.advanced-btn {
    animation: fadeInUp 0.6s ease-out;
}

.advanced-btn:nth-child(1) { animation-delay: 0.1s; }
.advanced-btn:nth-child(2) { animation-delay: 0.2s; }
.advanced-btn:nth-child(3) { animation-delay: 0.3s; }
.advanced-btn:nth-child(4) { animation-delay: 0.4s; }
.advanced-btn:nth-child(5) { animation-delay: 0.5s; }
.advanced-btn:nth-child(6) { animation-delay: 0.6s; }
.advanced-btn:nth-child(7) { animation-delay: 0.7s; }
.advanced-btn:nth-child(8) { animation-delay: 0.8s; }

.advanced-legend {
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

/* Loading animation */
.loading-shimmer {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200px 100%;
    animation: shimmer 2s infinite;
}

/* Fullscreen mode styles */
#advanced-research-map.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: linear-gradient(135deg, 
        rgba(245, 247, 250, 0.95) 0%, 
        rgba(195, 207, 226, 0.9) 25%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(240, 248, 255, 0.9) 75%,
        rgba(230, 240, 255, 0.95) 100%
    );
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#advanced-research-map.fullscreen-mode .advanced-controls {
    display: flex !important;
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10000 !important;
    opacity: 1 !important;
    visibility: visible !important;
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 10px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

#advanced-research-map.fullscreen-mode .advanced-legend {
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    opacity: 1 !important;
    visibility: visible !important;
    background: rgba(255, 255, 255, 0.95) !important;
}

#advanced-research-map.fullscreen-mode .advanced-info-panel {
    top: 20px;
    left: 20px;
    z-index: 10000;
    opacity: 1 !important;
    visibility: visible !important;
    background: rgba(255, 255, 255, 0.98) !important;
}

#advanced-research-map.fullscreen-mode .back-to-projects-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 10001 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.3s ease !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Additional fullscreen button visibility rule */
.fullscreen-mode .back-to-projects-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 10001 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fullscreen button special styling */
#fullscreen-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #0056b3;
    font-weight: 600;
}

#fullscreen-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

#fullscreen-btn:active {
    transform: translateY(0) scale(1.02);
}

/* Ensure panels are visible when not in fullscreen */
#advanced-research-map:not(.fullscreen-mode) .advanced-controls,
#advanced-research-map:not(.fullscreen-mode) .advanced-legend,
#advanced-research-map:not(.fullscreen-mode) .advanced-info-panel {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Ensure proper restoration after fullscreen */
#advanced-research-map .advanced-legend {
    opacity: 1 !important;
    visibility: visible !important;
    background: rgba(255, 255, 255, 0.95) !important;
}

#advanced-research-map .advanced-info-panel {
    opacity: 1 !important;
    visibility: visible !important;
    background: rgba(255, 255, 255, 0.98) !important;
}

/* Control button styling */
.advanced-controls {
    flex-wrap: wrap;
    gap: 5px;
}

.advanced-btn {
    white-space: nowrap;
    min-width: 80px;
}

.advanced-btn i {
    margin-right: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
    .advanced-graph-container {
        height: 400px;
    }
    
    .advanced-controls {
        flex-direction: column;
        gap: 3px;
    }
    
    .advanced-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .advanced-legend,
    .advanced-info-panel {
        max-width: 250px;
        font-size: 11px;
    }
}

/* Back to Projects Button - Bottom Right Corner */
.back-to-projects-btn {
    position: absolute !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 1000 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    gap: 8px !important;
}

.back-to-projects-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.back-to-projects-btn i {
    margin-right: 0;
    font-size: 16px;
}