/* Bulletproof Graph Styles */
.bulletproof-container {
    position: relative;
    width: 100%;
    height: 700px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Fullscreen Mode Styles */
.bulletproof-container.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
}

/* When the research-map container goes fullscreen */
#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, #667eea 0%, #764ba2 100%) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
}

/* Ensure the graph inside research-map takes full space in fullscreen */
#research-map.fullscreen-mode .bulletproof-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

#research-map.fullscreen-mode .graph-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: white !important;
}

/* Override Bootstrap column constraints in fullscreen */
#research-map.fullscreen-mode,
#research-map.fullscreen-mode * {
    max-width: none !important;
    flex: none !important;
    flex-basis: auto !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
}

/* Ensure fullscreen mode breaks out of any container constraints */
#research-map.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
}

/* Ensure fullscreen works in all browsers */
.bulletproof-container.fullscreen-mode:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
}

.bulletproof-container.fullscreen-mode:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
}

.bulletproof-container.fullscreen-mode:-moz-full-screen {
    width: 100vw !important;
    height: 100vh !important;
}

.bulletproof-container.fullscreen-mode:-ms-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
}

.bulletproof-container.fullscreen-mode .graph-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: white !important;
}

.fullscreen-graph {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: white !important;
}

.bulletproof-container.fullscreen-mode .controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.bulletproof-container.fullscreen-mode .legend {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    max-width: 250px;
}

.controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    align-items: center;
    justify-content: center;
}

.btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    min-height: 45px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Fullscreen button special styling */
#fullscreen-btn {
    position: relative;
    overflow: hidden;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    line-height: 1;
}

#fullscreen-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    z-index: 1;
}

#fullscreen-btn:hover::before {
    width: 100%;
    height: 100%;
}

#fullscreen-btn span {
    position: relative;
    z-index: 2;
}

/* Fullscreen mode animations */
.bulletproof-container.fullscreen-mode {
    animation: fullscreenEnter 0.3s ease-out;
}

@keyframes fullscreenEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fullscreen mode button animations */
.bulletproof-container.fullscreen-mode .btn {
    animation: buttonPulse 2s infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.6);
    }
}

.graph-container {
    width: 100%;
    height: 100%;
    background: white;
    margin: 20px;
    border-radius: 10px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.legend {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 200px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
}

.color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.color.discipline {
    background: #e3f2fd;
    border-color: #1976d2;
}

.color.method {
    background: #f3e5f5;
    border-color: #7b1fa2;
}

.color.project {
    background: #e8f5e8;
    border-color: #388e3c;
}

.color.institution {
    background: #fff3e0;
    border-color: #f57c00;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bulletproof-container {
        height: 500px;
    }
    
    .controls {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px;
        padding: 8px;
    }
    
    .legend {
        position: relative;
        bottom: auto;
        left: auto;
        margin: 10px;
        max-width: none;
    }
    
    .btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    #fullscreen-btn {
        font-size: 16px;
    }
}
